From: Zhang Rui Date: Wed, 28 May 2014 07:23:35 +0000 (+0800) Subject: PM / sleep: unregister wakeup source when disabling device wakeup X-Git-Tag: v4.9.8~6253^2^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0c5ff0ef80c2561ef20721299ecfc39c5a42f694;p=platform%2Fkernel%2Flinux-rpi3.git PM / sleep: unregister wakeup source when disabling device wakeup When enabling a device' wakeup capability, a wakeup source is created for the device automatically. But the wakeup source is not unregistered when disabling the device' wakeup capability. This results in zombie wakeup sources, after devices/drivers are unregistered. Signed-off-by: Zhang Rui Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index 2d56f41..eb1bd2e 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c @@ -318,10 +318,16 @@ int device_init_wakeup(struct device *dev, bool enable) { int ret = 0; + if (!dev) + return -EINVAL; + if (enable) { device_set_wakeup_capable(dev, true); ret = device_wakeup_enable(dev); } else { + if (dev->power.can_wakeup) + device_wakeup_disable(dev); + device_set_wakeup_capable(dev, false); }