diff options
author | Ravi Chandra Sadineni <ravisadineni@chromium.org> | 2018-06-01 22:32:15 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-06-06 03:23:36 -0400 |
commit | 2d5ed61ce9820a1fe7b076cc45c169524d767746 (patch) | |
tree | aa9a3d4d0e75d2cb0a3a5afb2373592540a9ae32 | |
parent | 3c89adb0d11117f64d5b501730be7fb2bf53a479 (diff) |
PM / wakeup: Export wakeup_count instead of event_count via sysfs
Currently we export event_count instead of wakeup_count via the
per-device wakeup_count sysfs attribute. Change it to wakeup_count
to make it more meaningful.
wakeup_count increments only when events_check_enabled is set,
that is whenever writes the current wakeup count to
/sys/power/wakeup_count. Also events_check_enabled is cleared on
every resume. User space is expected to write to this just before
suspend. This way pm_wakeup_event(), when called from IRQs handles,
will increment wakeup_count only if we are in system-wide
suspend-resume cycle and should give a fair approximation of how many
times a device may have triggered a wakeup from system suspend.
event_count on the other hand will increment every time
pm_wakeup_event() is called irrespective of whether we are in a
suspend-resume cycle and some drivers call it on every interrupt
which makes it less useful for system wakeup tracking.
Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
[ rjw: Subject & changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/base/power/sysfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c index 0f651efc58a1..d713738ce796 100644 --- a/drivers/base/power/sysfs.c +++ b/drivers/base/power/sysfs.c | |||
@@ -353,7 +353,7 @@ static ssize_t wakeup_count_show(struct device *dev, | |||
353 | 353 | ||
354 | spin_lock_irq(&dev->power.lock); | 354 | spin_lock_irq(&dev->power.lock); |
355 | if (dev->power.wakeup) { | 355 | if (dev->power.wakeup) { |
356 | count = dev->power.wakeup->event_count; | 356 | count = dev->power.wakeup->wakeup_count; |
357 | enabled = true; | 357 | enabled = true; |
358 | } | 358 | } |
359 | spin_unlock_irq(&dev->power.lock); | 359 | spin_unlock_irq(&dev->power.lock); |