lkml.org 
[lkml]   [2016]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] driver-core: platform: automatically mark wakeup devices
When probing platform drivers let's check if corresponding devices have
"wakeup-source" property defined (either in device tree, ACPI, or static
platform properties) and automatically enable such devices as wakeup
sources for the system. This will help us standardize on the name for this
property and reduce amount of boilerplate code in the drivers.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/base/platform.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 1dd6d3b..d14071a 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -514,9 +514,14 @@ static int platform_drv_probe(struct device *_dev)

ret = dev_pm_domain_attach(_dev, true);
if (ret != -EPROBE_DEFER && drv->probe) {
+ bool wakeup = device_property_read_bool(_dev, "wakeup-source");
+
+ device_init_wakeup(_dev, wakeup);
ret = drv->probe(dev);
- if (ret)
+ if (ret) {
+ device_init_wakeup(_dev, false);
dev_pm_domain_detach(_dev, true);
+ }
}

if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) {
@@ -540,6 +545,8 @@ static int platform_drv_remove(struct device *_dev)

if (drv->remove)
ret = drv->remove(dev);
+
+ device_init_wakeup(_dev, false);
dev_pm_domain_detach(_dev, true);

return ret;
--
2.6.0.rc2.230.g3dd15c0

--
Dmitry

\
 
 \ /
  Last update: 2016-01-18 03:21    [W:0.097 / U:0.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site