diff options
author | 2017-08-02 01:32:44 +0200 | |
---|---|---|
committer | 2017-08-08 17:11:48 +0200 | |
commit | 820b9b0c093ebd40c4b8e44c0e84613c877f4948 (patch) | |
tree | eb8522137c8a0734d9bed7c87bcfc4961c06ac08 /drivers/base | |
parent | Linux 4.13-rc4 (diff) | |
download | linux-820b9b0c093ebd40c4b8e44c0e84613c877f4948.tar.gz linux-820b9b0c093ebd40c4b8e44c0e84613c877f4948.tar.bz2 linux-820b9b0c093ebd40c4b8e44c0e84613c877f4948.zip |
PM / wakeup: Set power.can_wakeup if wakeup_sysfs_add() fails
Currently, an error from wakeup_sysfs_add() in
device_set_wakeup_capable() causes the device's power.can_wakeup
flag to remain unset even though the device technically is capable
of signaling wakeup.
If wakeup_sysfs_add() fails user space may not be able to enable
the device to wake up the system from sleep states, but at least
for some devices that does not matter.
For this reason, set or clear power.can_wakeup upfront and if
wakeup_sysfs_add() returns an error, print a message to the log.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/power/wakeup.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index 144e6d8fafc8..b49efe33099e 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c @@ -412,15 +412,17 @@ void device_set_wakeup_capable(struct device *dev, bool capable) if (!!dev->power.can_wakeup == !!capable) return; + dev->power.can_wakeup = capable; if (device_is_registered(dev) && !list_empty(&dev->power.entry)) { if (capable) { - if (wakeup_sysfs_add(dev)) - return; + int ret = wakeup_sysfs_add(dev); + + if (ret) + dev_info(dev, "Wakeup sysfs attributes not added\n"); } else { wakeup_sysfs_remove(dev); } } - dev->power.can_wakeup = capable; } EXPORT_SYMBOL_GPL(device_set_wakeup_capable); |