diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2008-03-11 19:57:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-04-19 22:10:24 -0400 |
commit | 58aca23226a19983571bd3b65167521fc64f5869 (patch) | |
tree | 1fd3f54ce5f18dc972b77970289a27a4e4a39bee /include/linux | |
parent | 6bcf19d02a5d7e627fa054f2f10e0a8d830df326 (diff) |
PM: Handle device registrations during suspend/resume
Modify the PM core to protect its data structures, specifically the
dpm_active list, from being corrupted if a child of the currently
suspending device is registered concurrently with its ->suspend()
callback. In that case, since the new device (the child) is added
to dpm_active after its parent, the PM core will attempt to
suspend it after the parent, which is wrong.
Introduce a new member of struct dev_pm_info, called 'sleeping',
and use it to check if the parent of the device being added to
dpm_active has been suspended, in which case the device registration
fails. Also, use 'sleeping' for checking if the ordering of devices
on dpm_active is correct.
Introduce variable 'all_sleeping' that will be set to 'true' once all
devices have been suspended and make new device registrations fail
until 'all_sleeping' is reset to 'false', in order to avoid having
unsuspended devices around while the system is going into a sleep state.
Remove pm_sleep_rwsem which is not necessary any more.
Special thanks to Alan Stern for discussions and suggestions that
lead to the creation of this patch.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/pm.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/pm.h b/include/linux/pm.h index 015b735811b4..e6b9f29e27d7 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -183,6 +183,7 @@ typedef struct pm_message { | |||
183 | struct dev_pm_info { | 183 | struct dev_pm_info { |
184 | pm_message_t power_state; | 184 | pm_message_t power_state; |
185 | unsigned can_wakeup:1; | 185 | unsigned can_wakeup:1; |
186 | bool sleeping:1; /* Owned by the PM core */ | ||
186 | #ifdef CONFIG_PM_SLEEP | 187 | #ifdef CONFIG_PM_SLEEP |
187 | unsigned should_wakeup:1; | 188 | unsigned should_wakeup:1; |
188 | struct list_head entry; | 189 | struct list_head entry; |