Greg KH
2005-06-21T03:18:31Z

[PATCH] Driver core: Don't "lose" devices on suspend on failure

I think we need this patch or we might "lose" devices to the dpm_irq_off
list if a failure occurs during the suspend process.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 42b16c051c3f462095fb8c9bad1bc05b34518cb9
tree 3178bf5b2e3b516b6aea270c757adf728db83836
parent 8215534ce7d073423bfa9c17405c43ab7636ca03
author Benjamin Herrenschmidt <benh@kernel.crashing.org> Tue, 31 May 2005 17:08:49 +1000
committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 20 Jun 2005 15:15:37 -0700

drivers/base/power/suspend.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c
--- a/drivers/base/power/suspend.c
+++ b/drivers/base/power/suspend.c
@@ -114,8 +114,19 @@ int device_suspend(pm_message_t state)
put_device(dev);
}
up(&dpm_list_sem);
- if (error)
+ if (error) {
+ /* we failed... before resuming, bring back devices from
+ * dpm_off_irq list back to main dpm_off list, we do want
+ * to call resume() on them, in case they partially suspended
+ * despite returning -EAGAIN
+ */
+ while (!list_empty(&dpm_off_irq)) {
+ struct list_head * entry = dpm_off_irq.next;
+ list_del(entry);
+ list_add(entry, &dpm_off);
+ }
dpm_resume();
+ }
up(&dpm_sem);
return error;
}