android_kernel_samsung_msm8976/kernel/power
Doug Berger 328d47689c PM / wakeup: Only update last time for active wakeup sources
commit 2ef7c01c0cdb170142058c6d8fe0697aee4e4d7d upstream.

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: b86ff9820f (PM / Sleep: Add user space interface for manipulating wakeup sources, v3)
Signed-off-by: Doug Berger <opendmb@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2019-07-27 21:52:47 +02:00
..
autosleep.c Import latest Samsung release 2017-04-18 03:43:52 +02:00
block_io.c
console.c
hibernate.c
Kconfig Import latest Samsung release 2017-04-18 03:43:52 +02:00
main.c PM / Sleep: Print last wakeup source on failed wakeup_count write 2018-05-26 00:39:32 +02:00
Makefile Import latest Samsung release 2017-04-18 03:43:52 +02:00
power.h
poweroff.c
process.c Import latest Samsung release 2017-04-18 03:43:52 +02:00
qos.c qos: wake up cores based on the qos updated cpu mask 2016-09-16 05:22:56 -07:00
register_list.h Import latest Samsung release 2017-04-18 03:43:52 +02:00
secpmic_dump.c Import latest Samsung release 2017-04-18 03:43:52 +02:00
snapshot.c
suspend.c Import T813XXS2BRC2 kernel source changes 2018-05-26 00:39:42 +02:00
suspend_test.c PM / sleep: fix device reference leak in test_suspend 2019-07-27 21:42:48 +02:00
suspend_time.c
swap.c
user.c
wakelock.c PM / wakeup: Only update last time for active wakeup sources 2019-07-27 21:52:47 +02:00
wakeup_reason.c Import latest Samsung release 2017-04-18 03:43:52 +02:00