]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
PM: sleep: Make pm_wakeup_clear() call more clear
authorSamuel Wu <wusamuel@google.com>
Thu, 21 Aug 2025 00:42:33 +0000 (17:42 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 4 Sep 2025 19:05:14 +0000 (21:05 +0200)
Move pm_wakeup_clear() to the same location as other functions that do
bookkeeping prior to suspend_prepare().

Since calling pm_wakeup_clear() is a prerequisite to setting up for
suspend and enabling functionalities of suspend (like aborting during
suspend), moving pm_wakeup_clear() higher up the call stack makes its
intent more clear and obvious that it is called prior to
suspend_prepare().

After this change, there is a slightly larger window when abort events
can be registered, but otherwise suspend functionality is the same.

Suggested-by: Saravana Kannan <saravanak@google.com>
Signed-off-by: Samuel Wu <wusamuel@google.com>
Link: https://patch.msgid.link/20250821004237.2712312-2-wusamuel@google.com
Reviewed-by: Saravana Kannan <saravanak@google.com>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
kernel/power/process.c
kernel/power/suspend.c

index dc0dfc349f22b4505980cfd5d3bd9cff21475987..8ff68ebaa1e08ea0e17301c35453e1fac8bac620 100644 (file)
@@ -132,7 +132,6 @@ int freeze_processes(void)
        if (!pm_freezing)
                static_branch_inc(&freezer_active);
 
-       pm_wakeup_clear(0);
        pm_freezing = true;
        error = try_to_freeze_tasks(true);
        if (!error)
index b4ca17c2fecf4d84f3194cfc6ef0b9d903d76130..4bb4686c1c08818fa97ebb1f13813173a7c49e55 100644 (file)
@@ -595,6 +595,7 @@ static int enter_state(suspend_state_t state)
        }
 
        pm_pr_dbg("Preparing system for sleep (%s)\n", mem_sleep_labels[state]);
+       pm_wakeup_clear(0);
        pm_suspend_clear_flags();
        error = suspend_prepare(state);
        if (error)