Эх сурвалжийг харах

PM / sleep: Return -EBUSY from suspend_enter() on wakeup detection

If a wakeup source is found to be pending in the last stage of
suspend after syscore suspend, then the machine won't suspend, but
suspend_enter() will return 0.  That is confusing, as wakeup detection
elsewhere causes -EBUSY to be returned from suspend_enter().

To avoid the confusion, make suspend_enter() return -EBUSY in that
case too.

Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
[ rjw: Subject and changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Ruchi Kandoi 10 жил өмнө
parent
commit
671767360d

+ 2 - 0
kernel/power/suspend.c

@@ -366,6 +366,8 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
 			trace_suspend_resume(TPS("machine_suspend"),
 			trace_suspend_resume(TPS("machine_suspend"),
 				state, false);
 				state, false);
 			events_check_enabled = false;
 			events_check_enabled = false;
+		} else if (*wakeup) {
+			error = -EBUSY;
 		}
 		}
 		syscore_resume();
 		syscore_resume();
 	}
 	}