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

From: Ulf Hansson
Date: Tue Mar 11 2025 - 12:08:59 EST


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@xxxxxxxxxx>
---

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

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

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;
--
2.43.0