* PM / wakeup: Add dev_wakeup_path() helper
@ 2020-03-20 11:32 patrice.chotard
2020-03-20 11:55 ` Ulf Hansson
0 siblings, 1 reply; 3+ messages in thread
From: patrice.chotard @ 2020-03-20 11:32 UTC (permalink / raw)
To: Rafael J . Wysocki, linux-pm, linux-kernel, Ulf Hansson
Cc: patrice.chotard, Erwan Le Ray, Alexandre TORGUE, Fabrice Gasnier
From: Patrice Chotard <patrice.chotard@st.com>
Add dev_wakeup_path() helper to avoid to spread
dev->power.wakeup_path test in drivers.
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@st.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;
+}
+
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: PM / wakeup: Add dev_wakeup_path() helper
2020-03-20 11:32 PM / wakeup: Add dev_wakeup_path() helper patrice.chotard
@ 2020-03-20 11:55 ` Ulf Hansson
2020-03-20 12:48 ` Patrice CHOTARD
0 siblings, 1 reply; 3+ messages in thread
From: Ulf Hansson @ 2020-03-20 11:55 UTC (permalink / raw)
To: Patrice CHOTARD
Cc: Rafael J . Wysocki, Linux PM, Linux Kernel Mailing List,
Erwan Le Ray, Alexandre TORGUE, Fabrice Gasnier
On Fri, 20 Mar 2020 at 12:32, <patrice.chotard@st.com> wrote:
>
> From: Patrice Chotard <patrice.chotard@st.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@st.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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PM / wakeup: Add dev_wakeup_path() helper
2020-03-20 11:55 ` Ulf Hansson
@ 2020-03-20 12:48 ` Patrice CHOTARD
0 siblings, 0 replies; 3+ messages in thread
From: Patrice CHOTARD @ 2020-03-20 12:48 UTC (permalink / raw)
To: Ulf Hansson
Cc: Rafael J . Wysocki, Linux PM, Linux Kernel Mailing List,
Erwan LE RAY, Alexandre TORGUE, Fabrice GASNIER
Hi Ulf
On 3/20/20 12:55 PM, Ulf Hansson wrote:
> On Fri, 20 Mar 2020 at 12:32, <patrice.chotard@st.com> wrote:
>> From: Patrice Chotard <patrice.chotard@st.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.
Ok, we wanted to be sure that this helper will be accepted before updating our driver with it.
A new series will be sent including this patch and driver using it.
>
>> 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@st.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?
right, not needed, wakeup_path is already a boolean....
Thanks
Patrice
>
>> +}
>> +
>> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-20 12:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 11:32 PM / wakeup: Add dev_wakeup_path() helper patrice.chotard
2020-03-20 11:55 ` Ulf Hansson
2020-03-20 12:48 ` Patrice CHOTARD
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.