[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPDyKFrWnK-TCMDExYHqpyo+5Fz9tKa0xWeauuQfTT1bQjepqQ@mail.gmail.com>
Date: Fri, 20 Mar 2020 12:55:03 +0100
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Patrice CHOTARD <patrice.chotard@...com>
Cc: "Rafael J . Wysocki" <rjw@...ysocki.net>,
Linux PM <linux-pm@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Erwan Le Ray <erwan.leray@...com>,
Alexandre TORGUE <alexandre.torgue@...com>,
Fabrice Gasnier <fabrice.gasnier@...com>
Subject: Re: PM / wakeup: Add dev_wakeup_path() helper
On Fri, 20 Mar 2020 at 12:32, <patrice.chotard@...com> wrote:
>
> From: Patrice Chotard <patrice.chotard@...com>
>
> Add dev_wakeup_path() helper to avoid to spread
> dev->power.wakeup_path test in drivers.
I am okay adding a helper, but would appreciate if you send a series
to convert those using the flag currently.
>
> In case CONFIG_PM_SLEEP is not set, wakeup_path is not defined,
> dev_wakeup_path() is returning false.
>
> Signed-off-by: Patrice Chotard <patrice.chotard@...com>
> ---
>
> Currently, in mainline kernel, no drivers are testing dev->power.wakeup_path
> for PM purpose. A stm32 serial driver patch will be submitted soon and will
> make usage of this helper.
>
> include/linux/pm_wakeup.h | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
> index aa3da6611533..d0bd13c19253 100644
> --- a/include/linux/pm_wakeup.h
> +++ b/include/linux/pm_wakeup.h
> @@ -84,6 +84,11 @@ static inline bool device_may_wakeup(struct device *dev)
> return dev->power.can_wakeup && !!dev->power.wakeup;
> }
>
> +static inline bool device_wakeup_path(struct device *dev)
> +{
> + return !!dev->power.wakeup_path;
Why using "!!" here?
> +}
> +
> static inline void device_set_wakeup_path(struct device *dev)
> {
> dev->power.wakeup_path = true;
> @@ -174,6 +179,11 @@ static inline bool device_may_wakeup(struct device *dev)
> return dev->power.can_wakeup && dev->power.should_wakeup;
> }
>
> +static inline bool device_wakeup_path(struct device *dev)
> +{
> + return false;
> +}
> +
> static inline void device_set_wakeup_path(struct device *dev) {}
>
> static inline void __pm_stay_awake(struct wakeup_source *ws) {}
> --
> 2.17.1
>
Kind regards
Uffe
Powered by blists - more mailing lists