We don't need to protect against multiple suspend calls, since subsequent
ones will happen on an empty (or at worst - short) list.
/**
* 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);
* 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)
goto Error;
}
Done:
+ up(&dpm_sem);
return error;
Error:
device_resume();