[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2182115.GafOXid1Dx@vostro.rjw.lan>
Date: Mon, 18 Jan 2016 15:47:27 +0100
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh@...nel.org>,
Grant Likely <grant.likely@...aro.org>,
Linus Walleij <linus.walleij@...aro.org>,
Thierry Reding <treding@...dia.com>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>, linux-kernel@...r.kernel.org,
"Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH] driver-core: platform: automatically mark wakeup devices
On Sunday, January 17, 2016 06:11:38 PM Dmitry Torokhov wrote:
> 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.
ACPI has other ways of telling the OS that the device is wakeup-capable,
but I guess the property in question can be used too (as long as it is
consistent with the other methods).
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.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);
But I'm wondering if this should be device_set_wakeup_capable(dev, true) rather?
device_init_wakeup() additionally sets the default in sysfs to "do wakeup"
which in principle may unblock spurious wakeups on some systems.
> 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;
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
Powered by blists - more mailing lists