PM / suspend: Clear wakeups before running PM callbacks

PM callbacks can be used as an indicator that the system is suspending, and
as such, a wakeup may be issued outside the notifier in order to cancel an
ongoing suspend. Clearing wakeups after running the PM callbacks can thus
cause wakeups to be missed. Fix it by simply clearing wakeups prior to
running PM callbacks.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: azrim <mirzaspc@gmail.com>
This commit is contained in:
Sultan Alsawaf 2022-05-04 09:14:14 -07:00 committed by azrim
parent 5f732a69cb
commit 1a58d5951e
No known key found for this signature in database
GPG Key ID: 497F8FB059B45D1C
2 changed files with 1 additions and 1 deletions

View File

@ -137,7 +137,6 @@ int freeze_processes(void)
if (!pm_freezing)
atomic_inc(&system_freezing_cnt);
pm_wakeup_clear(true);
pr_debug("Freezing user space processes ... ");
pm_freezing = true;
error = try_to_freeze_tasks(true);

View File

@ -571,6 +571,7 @@ static int enter_state(suspend_state_t state)
if (!mutex_trylock(&pm_mutex))
return -EBUSY;
pm_wakeup_clear(true);
if (state == PM_SUSPEND_TO_IDLE)
s2idle_begin();