summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2014-05-28 15:23:35 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-05-30 13:39:29 +0200
commit0c5ff0ef80c2561ef20721299ecfc39c5a42f694 (patch)
treecdd4bbc702c91d328f8b291ad472bf4c436110f6 /drivers/base
parent0399d4db3edf5c58b6ec7f672f089f5085e49ed5 (diff)
downloadlinux-0c5ff0ef80c2561ef20721299ecfc39c5a42f694.tar.bz2
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 <rui.zhang@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/wakeup.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 2d56f4113ae7..eb1bd2ecad8b 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);
}