summaryrefslogtreecommitdiffstats
path: root/kernel/power
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/suspend.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 0c61713b6e5c..5cf232795318 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -108,19 +108,32 @@ static void s2idle_loop(void)
{
pm_pr_dbg("suspend-to-idle\n");
- while (!dpm_suspend_noirq(PMSG_SUSPEND)) {
+ for (;;) {
+ int error;
+
+ dpm_noirq_begin();
+
/*
* Suspend-to-idle equals
* frozen processes + suspended devices + idle processors.
* Thus freeze_enter() should be called right after
* all devices have been suspended.
*/
- freeze_enter();
+ error = dpm_noirq_suspend_devices(PMSG_SUSPEND);
+ if (!error)
+ freeze_enter();
+
+ dpm_noirq_resume_devices(PMSG_RESUME);
+ if (error && (error != -EBUSY || !pm_wakeup_pending())) {
+ dpm_noirq_end();
+ break;
+ }
if (freeze_ops && freeze_ops->wake)
freeze_ops->wake();
- dpm_resume_noirq(PMSG_RESUME);
+ dpm_noirq_end();
+
if (freeze_ops && freeze_ops->sync)
freeze_ops->sync();