Commit c841acb0 authored by Patrick Mochel's avatar Patrick Mochel

[power] Fix locking in device_{suspend,resume}

We don't need to protect against multiple suspend calls, since subsequent
ones will happen on an empty (or at worst - short) list.
parent 86bc7dd8
......@@ -31,11 +31,13 @@ int resume_device(struct device * dev)
/**
* device_resume - Restore state of each device in system.
*
* Restore normal device state and release the dpm_sem.
* Walk the dpm_off list, remove each entry, resume the device,
* then add it to the dpm_active list.
*/
void device_resume(void)
{
down(&dpm_sem);
while(!list_empty(&dpm_off)) {
struct list_head * entry = dpm_off.next;
struct device * dev = to_device(entry);
......
......@@ -71,9 +71,6 @@ int suspend_device(struct device * dev, u32 state)
* b) prevent other PM operations from happening after we've begun.
* c) make sure we're exclusive when we disable interrupts.
*
* device_resume() will release dpm_sem after restoring state to
* all devices (as will this on error). You must call it once you've
* called device_suspend().
*/
int device_suspend(u32 state)
......@@ -88,6 +85,7 @@ int device_suspend(u32 state)
goto Error;
}
Done:
up(&dpm_sem);
return error;
Error:
device_resume();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment