Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7e285435 authored by Doug Berger's avatar Doug Berger Committed by Tri Vo
Browse files

UPSTREAM: PM / wakeup: Only update last time for active wakeup sources



When wakelock support was added, the wakeup_source_add() function
was updated to set the last_time value of the wakeup source. This
has the unintended side effect of producing confusing output from
pm_print_active_wakeup_sources() when a wakeup source is added
prior to a sleep that is blocked by a different wakeup source.

The function pm_print_active_wakeup_sources() will search for the
most recently active wakeup source when no active source is found.
If a wakeup source is added after a different wakeup source blocks
the system from going to sleep it may have a later last_time value
than the blocking source and be output as the last active wakeup
source even if it has never actually been active.

It looks to me like the change to wakeup_source_add() was made to
prevent the wakelock garbage collection from accidentally dropping
a wakelock during the narrow window between adding the wakelock to
the wakelock list in wakelock_lookup_add() and the activation of
the wakeup source in pm_wake_lock().

This commit changes the behavior so that only the last_time of the
wakeup source used by a wakelock is initialized prior to adding it
to the wakeup source list. This preserves the meaning of the
last_time value as the last time the wakeup source was active and
allows a wakeup source that has never been active to have a
last_time value of 0.

Fixes: b86ff982 (PM / Sleep: Add user space interface for manipulating wakeup sources, v3)
Signed-off-by: default avatarDoug Berger <opendmb@gmail.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 2ef7c01c)
Bug: 129087298
Signed-off-by: default avatarTri Vo <trong@google.com>
Change-Id: If1c68d08d05d154806fba7879acf091ce80c44bf
parent c17a6999
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment