From benh@kernel.crashing.org Tue May 31 00:23:47 2005 Subject: Driver core: Don't "lose" devices on suspend on failure From: Benjamin Herrenschmidt To: Patrick Mochel , Greg KH Date: Tue, 31 May 2005 17:08:49 +1000 Message-Id: <1117523329.5826.14.camel@gaston> 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 Signed-off-by: Greg Kroah-Hartman --- drivers/base/power/suspend.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletion(-) --- gregkh-2.6.orig/drivers/base/power/suspend.c 2005-06-01 13:59:13.000000000 -0700 +++ gregkh-2.6/drivers/base/power/suspend.c 2005-06-01 14:11:42.000000000 -0700 @@ -114,8 +114,19 @@ 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; }