power: Do not clear events_check_enabled in pm_wakeup_pending()
Subsystems (4)
PATCH 1/1 power: Do not clear events_check_enabled in pm_wakeup_pending()
events_check_enabled bool is set when wakeup_count sysfs attribute is written. User level daemon is expected to write this attribute just before suspend.
When this boolean is set, calls to pm_wakeup_event() will result in increment of per device and global wakeup count that helps in identifying the wake source. global wakeup count is also used by pm_wakeup_pending() to identify if there are any pending events that should result in an suspend abort.
Currently calls to pm_wakeup_pending() also clears events_check_enabled. This can be a problem when there are multiple wake events or when the suspend is aborted due to an interrupt on a shared interrupt line. For example an Mfd device can create several platform devices which might fetch the state on resume in the driver resume method and increment the wakeup count if needed. But if events_check_enabled is cleared before resume methods get to execute, wakeup count will not be incremented. Thus let us not reset the bool here.
Note that events_check_enabled is also cleared in suspend.c/enter_state() on every resume at the end.
--- drivers/base/power/wakeup.c | 1 - 1 file changed, 1 deletion(-)
drivers/base/power/wakeup.c +0 -1
@@ -838,7 +838,6 @@ bool pm_wakeup_pending(void)split_counters (&cnt, &inpr); ret = (cnt != saved_count || inpr >0 ); - events_check_enabled = !ret; }raw_spin_unlock_irqrestore (&events_lock, flags);
Signature · 1 line
2.20.1
Hi,
Just wanted to check if this o.k.
Thanks,
Ravi
Quoted 43 lines · Ravi Chandra Sadineni
events_check_enabledbool is set whenwakeup_countsysfs attribute is written. User level daemon is expected to write this attribute just before suspend.When this boolean is set, calls to
pm_wakeup_event()will result in increment of per device and global wakeup count that helps in identifying the wake source. global wakeup count is also used bypm_wakeup_pending()to identify if there are any pending events that should result in an suspend abort.Currently calls to
pm_wakeup_pending()also clearsevents_check_enabled. This can be a problem when there are multiple wake events or when the suspend is aborted due to an interrupt on a shared interrupt line. For example an Mfd device can create several platform devices which might fetch the state on resume in the driver resume method and increment the wakeup count if needed. But ifevents_check_enabledis cleared before resume methods get to execute, wakeup count will not be incremented. Thus let us not reset the bool here.Note that
events_check_enabledis also cleared in suspend.c/enter_state() on every resume at the end.Signed-off-by Ravi Chandra Sadineni <[email protected]>--- drivers/base/power/wakeup.c | 1 - 1 file changed, 1 deletion(-)drivers/base/power/wakeup.c +0
-2@@ -838,7 +838,6 @@ bool pm_wakeup_pending(void)split_counters (&cnt, &inpr); ret = (cnt != saved_count || inpr >0 ); - events_check_enabled = !ret; }raw_spin_unlock_irqrestore (&events_lock, flags); --2.20.1
Greg KH
maintainerQuoted 3 lines · Ravi Chandra Sadineni
Hi,
Just wanted to check if this o.k.
You seem to have forgoten to send this to the maintainer of this file :(
Please use scripts/get_maintainer.pl and resend it, remembering to send it to Rafael next time :)
thanks,
greg k-h