Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1311218

[PATCH] driver-core: platform: automatically mark wakeup devices

From Dmitry Torokhov <dmitry.torokhov@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] driver-core: platform: automatically mark wakeup devices
Date 2016-01-18 03:20 +0100
Message-ID <qS7Ad-2zb-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] driver-core: platform: automatically mark wakeup devices Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-01-18 03:20 +0100
  Re: [PATCH] driver-core: platform: automatically mark wakeup devices Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-01-18 06:20 +0100
    Re: [PATCH] driver-core: platform: automatically mark wakeup devices Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-01-18 07:20 +0100
      Re: [PATCH] driver-core: platform: automatically mark wakeup devices Sudeep Holla <sudeep.holla@arm.com> - 2016-01-18 16:40 +0100
  Re: [PATCH] driver-core: platform: automatically mark wakeup devices "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-01-18 15:50 +0100
    Re: [PATCH] driver-core: platform: automatically mark wakeup devices Sudeep Holla <sudeep.holla@arm.com> - 2016-01-18 16:30 +0100
      Re: [PATCH] driver-core: platform: automatically mark wakeup devices "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-01-18 16:50 +0100
        Re: [PATCH] driver-core: platform: automatically mark wakeup devices Sudeep Holla <sudeep.holla@arm.com> - 2016-01-18 17:00 +0100
          Re: [PATCH] driver-core: platform: automatically mark wakeup devices "Rafael J. Wysocki" <rafael@kernel.org> - 2016-01-18 18:10 +0100
    Re: [PATCH] driver-core: platform: automatically mark wakeup devices Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-01-18 17:30 +0100
      Re: [PATCH] driver-core: platform: automatically mark wakeup devices "Rafael J. Wysocki" <rafael@kernel.org> - 2016-01-18 18:20 +0100
        Re: [PATCH] driver-core: platform: automatically mark wakeup devices Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-01-18 19:00 +0100
          Re: [PATCH] driver-core: platform: automatically mark wakeup devices "Rafael J. Wysocki" <rafael@kernel.org> - 2016-01-18 23:20 +0100
            Re: [PATCH] driver-core: platform: automatically mark wakeup devices Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-01-20 02:00 +0100
              Re: [PATCH] driver-core: platform: automatically mark wakeup devices "Rafael J. Wysocki" <rafael@kernel.org> - 2016-01-20 03:50 +0100
                Re: [PATCH] driver-core: platform: automatically mark wakeup devices "Rafael J. Wysocki" <rafael@kernel.org> - 2016-01-20 15:00 +0100
                Re: [PATCH] driver-core: platform: automatically mark wakeup devices "Rafael J. Wysocki" <rafael@kernel.org> - 2016-01-21 00:10 +0100
                Re: [PATCH] driver-core: platform: automatically mark wakeup devices Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-01-21 01:30 +0100
                Re: [PATCH] driver-core: platform: automatically mark wakeup devices "Rafael J. Wysocki" <rafael@kernel.org> - 2016-01-26 17:50 +0100

csiph-web