PM / Sleep: Fix possible infinite loop during wakeup source destruction
authorRafael J. Wysocki <rjw@sisk.pl>
Fri, 17 Feb 2012 22:39:20 +0000 (23:39 +0100)
committerArve Hjønnevåg <arve@android.com>
Sat, 17 Mar 2012 01:10:26 +0000 (18:10 -0700)
commit649caa0ad80f49bbb7b90012433973809ead8826
tree7e5898e562e7a4801ccfab34fdc10b2f5e4173c2
parent3c63797031913f63fe31671d6de47014f00af415
PM / Sleep: Fix possible infinite loop during wakeup source destruction

If wakeup_source_destroy() is called for an active wakeup source that
is never deactivated, it will spin forever.  To prevent that from
happening, make wakeup_source_destroy() call __pm_relax() for the
wakeup source object it is about to free instead of waiting until
it will be deactivated by someone else.  However, for this to work
it also needs to make sure that the timer function will not be
executed after the final __pm_relax(), so make it run
del_timer_sync() on the wakeup source's timer beforehand.

Additionally, update the kerneldoc comment to document the
requirement that __pm_stay_awake() and __pm_wakeup_event() must not
be run in parallel with wakeup_source_destroy().

Reported-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
drivers/base/power/wakeup.c