]> git.ipfire.org Git - people/arne_f/kernel.git/commit
PM / wakeup: Rework wakeup source timer cancellation
authorViresh Kumar <viresh.kumar@linaro.org>
Fri, 8 Mar 2019 09:53:11 +0000 (15:23 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Mar 2019 13:35:29 +0000 (14:35 +0100)
commit4e2a61f23c6f7882fec43b9e24eccdad2bee49ec
treedad3267f20ea758b90016288930b561d46e22674
parent086135b25b925a8142b9c612eddc87d2d19c2faa
PM / wakeup: Rework wakeup source timer cancellation

commit 1fad17fb1bbcd73159c2b992668a6957ecc5af8a upstream.

If wakeup_source_add() is called right after wakeup_source_remove()
for the same wakeup source, timer_setup() may be called for a
potentially scheduled timer which is incorrect.

To avoid that, move the wakeup source timer cancellation from
wakeup_source_drop() to wakeup_source_remove().

Moreover, make wakeup_source_remove() clear the timer function after
canceling the timer to let wakeup_source_not_registered() treat
unregistered wakeup sources in the same way as the ones that have
never been registered.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: 4.4+ <stable@vger.kernel.org> # 4.4+
[ rjw: Subject, changelog, merged two patches together ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/power/wakeup.c