-
Andrew Morton authored
From: Paul Mackerras <paulus@samba.org> Currently the device_pm_foo() functions are rather prone to deadlocks during suspend/resume. This is because the dpm_sem is held for the duration of device_suspend() and device_resume() as well as device_pm_add() and device_pm_remove(). If for any reason you get a device addition or removal triggered by a device's suspend or resume code, you get a deadlock. (The classic example is a USB host adaptor resuming and discovering that the mouse you used to have plugged in has gone away.) This patch fixes the problem by using a separate semaphore, called dpm_list_sem, to cover the places where we need the device pm lists to be stable, and by being careful about how we traverse the lists on suspend and resume. I have analysed the various cases that can occur and I am confident that I have handled them all correctly. I posted this patch together with a detailed analysis 10 days ago. Signed-off-by Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
46c94ace