diff mbox series

[v2,2/2] PM: s2idle: Extend comment in s2idle_enter()

Message ID 20250311160827.1129643-3-ulf.hansson@linaro.org
State New
Headers show
Series PM: s2idle: A couple of minor lock-simplifications | expand

Commit Message

Ulf Hansson March 11, 2025, 4:08 p.m. UTC
The s2idle_lock must be held while checking for a pending wakeup and while
moving into S2IDLE_STATE_ENTER, to make sure a wakeup doesn't get lost.
Let's extend the comment in the code to make this clear.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---

Changes in v2:
 - New patch. Suggested by Rafael.

---
 kernel/power/suspend.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 90fb06ca07d2..b7aa1db278ff 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -91,8 +91,12 @@  static void s2idle_enter(void)
 {
 	trace_suspend_resume(TPS("machine_suspend"), PM_SUSPEND_TO_IDLE, true);
 
-	/* CPUs can't be hotplugged here so let's not protect for it. */
-
+	/*
+	 * The s2idle_lock must be held while checking for a pending wakeup and
+	 * while moving into S2IDLE_STATE_ENTER, to make sure a wakeup doesn't
+	 * get lost. Note also that CPUs can't be hotplugged here so let's not
+	 * protect for it.
+	 */
 	raw_spin_lock_irq(&s2idle_lock);
 	if (pm_wakeup_pending())
 		goto out;