All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] driver-core: platform: automatically mark wakeup devices
@ 2016-01-18  2:11 Dmitry Torokhov
  2016-01-18  5:11 ` Greg Kroah-Hartman
  2016-01-18 14:47 ` Rafael J. Wysocki
  0 siblings, 2 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2016-01-18  2:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Rob Herring, Grant Likely, Linus Walleij, Thierry Reding,
	Uwe Kleine-König, linux-kernel, Rafael J. Wysocki

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

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2016-01-26 16:47 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-18  2:11 [PATCH] driver-core: platform: automatically mark wakeup devices Dmitry Torokhov
2016-01-18  5:11 ` Greg Kroah-Hartman
2016-01-18  6:14   ` Dmitry Torokhov
2016-01-18 15:35     ` Sudeep Holla
2016-01-18 14:47 ` Rafael J. Wysocki
2016-01-18 15:23   ` Sudeep Holla
2016-01-18 15:41     ` Rafael J. Wysocki
2016-01-18 15:58       ` Sudeep Holla
2016-01-18 17:09         ` Rafael J. Wysocki
2016-01-18 16:22   ` Dmitry Torokhov
2016-01-18 17:19     ` Rafael J. Wysocki
2016-01-18 17:55       ` Dmitry Torokhov
2016-01-18 22:18         ` Rafael J. Wysocki
2016-01-20  0:45           ` Dmitry Torokhov
2016-01-20  2:40             ` Rafael J. Wysocki
2016-01-20 13:51               ` Rafael J. Wysocki
2016-01-20 23:01                 ` Rafael J. Wysocki
2016-01-21  0:23                   ` Dmitry Torokhov
2016-01-26 16:47                     ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.