linux/drivers/base/power
Doug Berger f3ba3c79f8 PM / wakeup: Only update last time for active wakeup sources
commit 2ef7c01c0c 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>
History 2018-11-20 18:04:52 +00:00
..
clock_ops.c PM / clk: Fix crash in clocks management code if !CONFIG_PM_RUNTIME 2014-11-03 10:52:06 +00:00
common.c drivers/base: delete non-required instances of include <linux/init.h> 2014-02-14 14:31:37 -08:00
domain.c PM / Domains: Fix unsafe iteration over modified list of device links 2017-10-12 15:27:56 +01:00
domain_governor.c drivers/base: delete non-required instances of include <linux/init.h> 2014-02-14 14:31:37 -08:00
generic_ops.c PM / Runtime: Spelling s/competing/completing/ 2014-03-26 16:33:53 +01:00
main.c PM / sleep: don't suspend parent when async child suspend_{noirq, late} fails 2017-02-23 03:54:32 +00:00
Makefile PM: Add pm_runtime_suspend|resume_force functions 2014-03-02 00:18:15 +01:00
opp.c Merge branch 'pm-cpufreq' 2014-06-03 23:13:20 +02:00
power.h PM / QoS: Rename device resume latency QoS items 2014-02-11 00:35:23 +01:00
qos.c PM / QoS: Fix memory leak on resume_latency.notifiers 2017-06-05 21:17:11 +01:00
runtime.c PM / Runtime: Fix error path in pm_runtime_force_resume() 2016-08-22 22:37:51 +01:00
sysfs.c PM / QoS: return -EINVAL for bogus strings 2017-10-12 15:28:05 +01:00
trace.c drivers/base: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required. 2011-10-31 19:31:38 -04:00
wakeup.c PM / wakeup: Only update last time for active wakeup sources 2018-11-20 18:04:52 +00:00