Skip to content

Commit 2d5ed61

Browse files
Ravi Chandra Sadinenirafaeljw
authored andcommitted
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 <[email protected]> Acked-by: Pavel Machek <[email protected]> [ rjw: Subject & changelog ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 3c89adb commit 2d5ed61

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/base/power/sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ static ssize_t wakeup_count_show(struct device *dev,
353353

354354
spin_lock_irq(&dev->power.lock);
355355
if (dev->power.wakeup) {
356-
count = dev->power.wakeup->event_count;
356+
count = dev->power.wakeup->wakeup_count;
357357
enabled = true;
358358
}
359359
spin_unlock_irq(&dev->power.lock);

0 commit comments

Comments
 (0)