mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] PM / Sleep: call early resume handlers when suspend_noirq fails
@ 2012-07-19  2:08 Colin Cross
  2012-07-19  9:10 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Cross @ 2012-07-19  2:08 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Colin Cross, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	linux-pm, linux-kernel

Commit cf579dfb82550e34de7ccf3ef090d8b834ccd3a9 (PM / Sleep: Introduce
"late suspend" and "early resume" of devices) introduced a bug where
suspend_late handlers would be called, but if dpm_suspend_noirq returned
an error the early_resume handlers would never be called.  All devices
would end up on the dpm_late_early_list, and would never be resumed
again.

Fix it by calling dpm_resume_early when dpm_suspend_noirq returns
an error.

Signed-off-by: Colin Cross <ccross@android.com>
---
 drivers/base/power/main.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 9cb845e..742fcbe 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -989,8 +989,16 @@ static int dpm_suspend_late(pm_message_t state)
 int dpm_suspend_end(pm_message_t state)
 {
 	int error = dpm_suspend_late(state);
+	if (error)
+		return error;
 
-	return error ? : dpm_suspend_noirq(state);
+	error = dpm_suspend_noirq(state);
+	if (error) {
+		dpm_resume_early(state);
+		return error;
+	}
+
+	return 0;
 }
 EXPORT_SYMBOL_GPL(dpm_suspend_end);
 
-- 
1.7.7.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-19  9:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-19  2:08 [PATCH] PM / Sleep: call early resume handlers when suspend_noirq fails Colin Cross
2012-07-19  9:10 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome