linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/4] PM: Add dev_wakeup_path() helper
@ 2020-11-06  7:33 patrice.chotard
  2020-11-06  7:33 ` [PATCH v1 1/4] PM / wakeup: " patrice.chotard
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: patrice.chotard @ 2020-11-06  7:33 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-pm, linux-kernel, Ulf Hansson, Kevin Hilman
  Cc: patrice.chotard, Erwan Le Ray, Alexandre TORGUE, Fabrice Gasnier,
	Pierre-Yves MORDRET, amelie.delaunay

From: Patrice Chotard <patrice.chotard@st.com>

Add dev_wakeup_path() helper to avoid to spread
dev->power.wakeup_path test in drivers.

Cc: amelie.delaunay@st.com,
    erwan_leray@st.com,
    fabrice.gasnier@st.com,
    alexandre.torgue@st.com,
    alain.volmat@st.com,
    pierre-yves.mordret@st.com

*** BLURB HERE ***

Patrice Chotard (4):
  PM / wakeup: Add dev_wakeup_path() helper
  PM: domains: Make usage of device_wakeup_path() helper
  PM: core: Make usage of device_wakeup_path() helper
  i2c: stm32f7: Make usage of dev_wakeup_path() helper

 drivers/base/power/domain.c      |  4 ++--
 drivers/base/power/main.c        |  4 ++--
 drivers/i2c/busses/i2c-stm32f7.c |  4 ++--
 include/linux/pm_wakeup.h        | 10 ++++++++++
 4 files changed, 16 insertions(+), 6 deletions(-)

-- 
2.17.1


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

* [PATCH v1 1/4] PM / wakeup: Add dev_wakeup_path() helper
  2020-11-06  7:33 [PATCH v1 0/4] PM: Add dev_wakeup_path() helper patrice.chotard
@ 2020-11-06  7:33 ` patrice.chotard
  2020-11-06  7:33 ` [PATCH v1 2/4] PM: domains: Make usage of device_wakeup_path() helper patrice.chotard
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: patrice.chotard @ 2020-11-06  7:33 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-pm, linux-kernel, Ulf Hansson, Kevin Hilman
  Cc: patrice.chotard, Erwan Le Ray, Alexandre TORGUE, Fabrice Gasnier,
	Pierre-Yves MORDRET, amelie.delaunay, erwan_leray, alain.volmat

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>
---
 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..196a157456aa 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] 8+ messages in thread

* [PATCH v1 2/4] PM: domains: Make usage of device_wakeup_path() helper
  2020-11-06  7:33 [PATCH v1 0/4] PM: Add dev_wakeup_path() helper patrice.chotard
  2020-11-06  7:33 ` [PATCH v1 1/4] PM / wakeup: " patrice.chotard
@ 2020-11-06  7:33 ` patrice.chotard
  2020-11-06  7:33 ` [PATCH v1 3/4] PM: core: " patrice.chotard
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: patrice.chotard @ 2020-11-06  7:33 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-pm, linux-kernel, Ulf Hansson, Kevin Hilman
  Cc: patrice.chotard, Erwan Le Ray, Alexandre TORGUE, Fabrice Gasnier,
	Pierre-Yves MORDRET, amelie.delaunay, erwan_leray, alain.volmat

From: Patrice Chotard <patrice.chotard@st.com>

Make usage of dev_wakeup_path() helper.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---
 drivers/base/power/domain.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 743268996336..e0894ef8457c 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1142,7 +1142,7 @@ static int genpd_finish_suspend(struct device *dev, bool poweroff)
 	if (ret)
 		return ret;
 
-	if (dev->power.wakeup_path && genpd_is_active_wakeup(genpd))
+	if (device_wakeup_path(dev) && genpd_is_active_wakeup(genpd))
 		return 0;
 
 	if (genpd->dev_ops.stop && genpd->dev_ops.start &&
@@ -1196,7 +1196,7 @@ static int genpd_resume_noirq(struct device *dev)
 	if (IS_ERR(genpd))
 		return -EINVAL;
 
-	if (dev->power.wakeup_path && genpd_is_active_wakeup(genpd))
+	if (device_wakeup_path(dev) && genpd_is_active_wakeup(genpd))
 		return pm_generic_resume_noirq(dev);
 
 	genpd_lock(genpd);
-- 
2.17.1


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

* [PATCH v1 3/4] PM: core: Make usage of device_wakeup_path() helper
  2020-11-06  7:33 [PATCH v1 0/4] PM: Add dev_wakeup_path() helper patrice.chotard
  2020-11-06  7:33 ` [PATCH v1 1/4] PM / wakeup: " patrice.chotard
  2020-11-06  7:33 ` [PATCH v1 2/4] PM: domains: Make usage of device_wakeup_path() helper patrice.chotard
@ 2020-11-06  7:33 ` patrice.chotard
  2020-11-06  7:33 ` [PATCH v1 4/4] i2c: stm32f7: Make usage of dev_wakeup_path() helper patrice.chotard
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: patrice.chotard @ 2020-11-06  7:33 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-pm, linux-kernel, Ulf Hansson, Kevin Hilman
  Cc: patrice.chotard, Erwan Le Ray, Alexandre TORGUE, Fabrice Gasnier,
	Pierre-Yves MORDRET, amelie.delaunay, erwan_leray, alain.volmat

From: Patrice Chotard <patrice.chotard@st.com>

Make usage of dev_wakeup_path() helper.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---
 drivers/base/power/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index c7ac49042cee..921c5b2ec30a 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1359,7 +1359,7 @@ static void dpm_propagate_wakeup_to_parent(struct device *dev)
 
 	spin_lock_irq(&parent->power.lock);
 
-	if (dev->power.wakeup_path && !parent->power.ignore_children)
+	if (device_wakeup_path(dev) && !parent->power.ignore_children)
 		parent->power.wakeup_path = true;
 
 	spin_unlock_irq(&parent->power.lock);
@@ -1627,7 +1627,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
 		goto Complete;
 
 	/* Avoid direct_complete to let wakeup_path propagate. */
-	if (device_may_wakeup(dev) || dev->power.wakeup_path)
+	if (device_may_wakeup(dev) || device_wakeup_path(dev))
 		dev->power.direct_complete = false;
 
 	if (dev->power.direct_complete) {
-- 
2.17.1


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

* [PATCH v1 4/4] i2c: stm32f7: Make usage of dev_wakeup_path() helper
  2020-11-06  7:33 [PATCH v1 0/4] PM: Add dev_wakeup_path() helper patrice.chotard
                   ` (2 preceding siblings ...)
  2020-11-06  7:33 ` [PATCH v1 3/4] PM: core: " patrice.chotard
@ 2020-11-06  7:33 ` patrice.chotard
  2020-11-06  9:46 ` [PATCH v1 0/4] PM: Add " Ulf Hansson
  2020-11-18 13:08 ` Rafael J. Wysocki
  5 siblings, 0 replies; 8+ messages in thread
From: patrice.chotard @ 2020-11-06  7:33 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-pm, linux-kernel, Ulf Hansson, Kevin Hilman
  Cc: patrice.chotard, Erwan Le Ray, Alexandre TORGUE, Fabrice Gasnier,
	Pierre-Yves MORDRET, amelie.delaunay, erwan_leray, alain.volmat

From: Patrice Chotard <patrice.chotard@st.com>

Make usage of dev_wakeup_path() helper.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---
 drivers/i2c/busses/i2c-stm32f7.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index f41f51a176a1..9aa8e65b511e 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -2322,7 +2322,7 @@ static int stm32f7_i2c_suspend(struct device *dev)
 
 	i2c_mark_adapter_suspended(&i2c_dev->adap);
 
-	if (!device_may_wakeup(dev) && !dev->power.wakeup_path) {
+	if (!device_may_wakeup(dev) && !device_wakeup_path(dev)) {
 		ret = stm32f7_i2c_regs_backup(i2c_dev);
 		if (ret < 0) {
 			i2c_mark_adapter_resumed(&i2c_dev->adap);
@@ -2341,7 +2341,7 @@ static int stm32f7_i2c_resume(struct device *dev)
 	struct stm32f7_i2c_dev *i2c_dev = dev_get_drvdata(dev);
 	int ret;
 
-	if (!device_may_wakeup(dev) && !dev->power.wakeup_path) {
+	if (!device_may_wakeup(dev) && !device_wakeup_path(dev)) {
 		ret = pm_runtime_force_resume(dev);
 		if (ret < 0)
 			return ret;
-- 
2.17.1


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

* Re: [PATCH v1 0/4] PM: Add dev_wakeup_path() helper
  2020-11-06  7:33 [PATCH v1 0/4] PM: Add dev_wakeup_path() helper patrice.chotard
                   ` (3 preceding siblings ...)
  2020-11-06  7:33 ` [PATCH v1 4/4] i2c: stm32f7: Make usage of dev_wakeup_path() helper patrice.chotard
@ 2020-11-06  9:46 ` Ulf Hansson
  2020-11-18 13:08 ` Rafael J. Wysocki
  5 siblings, 0 replies; 8+ messages in thread
From: Ulf Hansson @ 2020-11-06  9:46 UTC (permalink / raw)
  To: Patrice CHOTARD
  Cc: Rafael J . Wysocki, Linux PM, Linux Kernel Mailing List,
	Kevin Hilman, Erwan Le Ray, Alexandre TORGUE, Fabrice Gasnier,
	Pierre-Yves MORDRET, amelie.delaunay

On Fri, 6 Nov 2020 at 08:34, <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.
>
> Cc: amelie.delaunay@st.com,
>     erwan_leray@st.com,
>     fabrice.gasnier@st.com,
>     alexandre.torgue@st.com,
>     alain.volmat@st.com,
>     pierre-yves.mordret@st.com
>
> *** BLURB HERE ***

:-)

>
> Patrice Chotard (4):
>   PM / wakeup: Add dev_wakeup_path() helper
>   PM: domains: Make usage of device_wakeup_path() helper
>   PM: core: Make usage of device_wakeup_path() helper
>   i2c: stm32f7: Make usage of dev_wakeup_path() helper
>
>  drivers/base/power/domain.c      |  4 ++--
>  drivers/base/power/main.c        |  4 ++--
>  drivers/i2c/busses/i2c-stm32f7.c |  4 ++--
>  include/linux/pm_wakeup.h        | 10 ++++++++++
>  4 files changed, 16 insertions(+), 6 deletions(-)
>
> --
> 2.17.1
>

For the series:

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

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

* Re: [PATCH v1 0/4] PM: Add dev_wakeup_path() helper
  2020-11-06  7:33 [PATCH v1 0/4] PM: Add dev_wakeup_path() helper patrice.chotard
                   ` (4 preceding siblings ...)
  2020-11-06  9:46 ` [PATCH v1 0/4] PM: Add " Ulf Hansson
@ 2020-11-18 13:08 ` Rafael J. Wysocki
  2020-11-19  7:27   ` Patrice CHOTARD
  5 siblings, 1 reply; 8+ messages in thread
From: Rafael J. Wysocki @ 2020-11-18 13:08 UTC (permalink / raw)
  To: patrice.chotard
  Cc: Rafael J . Wysocki, Linux PM, Linux Kernel Mailing List,
	Ulf Hansson, Kevin Hilman, Erwan Le Ray, Alexandre TORGUE,
	Fabrice Gasnier, Pierre-Yves MORDRET, amelie.delaunay

On Fri, Nov 6, 2020 at 8:34 AM <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.

OK

> Cc: amelie.delaunay@st.com,
>     erwan_leray@st.com,
>     fabrice.gasnier@st.com,
>     alexandre.torgue@st.com,
>     alain.volmat@st.com,
>     pierre-yves.mordret@st.com
>
> *** BLURB HERE ***

Hmm?

> Patrice Chotard (4):
>   PM / wakeup: Add dev_wakeup_path() helper
>   PM: domains: Make usage of device_wakeup_path() helper
>   PM: core: Make usage of device_wakeup_path() helper
>   i2c: stm32f7: Make usage of dev_wakeup_path() helper

Please fold the patches into one and add the R-by from Ulf to it.

Thanks!

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

* Re: [PATCH v1 0/4] PM: Add dev_wakeup_path() helper
  2020-11-18 13:08 ` Rafael J. Wysocki
@ 2020-11-19  7:27   ` Patrice CHOTARD
  0 siblings, 0 replies; 8+ messages in thread
From: Patrice CHOTARD @ 2020-11-19  7:27 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Rafael J . Wysocki, Linux PM, Linux Kernel Mailing List,
	Ulf Hansson, Kevin Hilman, Erwan LE RAY, Alexandre TORGUE,
	Fabrice GASNIER, Pierre Yves MORDRET, Amelie DELAUNAY

Hi Rafael

On 11/18/20 2:08 PM, Rafael J. Wysocki wrote:
> On Fri, Nov 6, 2020 at 8:34 AM <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.
> OK
>
>> Cc: amelie.delaunay@st.com,
>>     erwan_leray@st.com,
>>     fabrice.gasnier@st.com,
>>     alexandre.torgue@st.com,
>>     alain.volmat@st.com,
>>     pierre-yves.mordret@st.com
>>
>> *** BLURB HERE ***
> Hmm?
>
>> Patrice Chotard (4):
>>   PM / wakeup: Add dev_wakeup_path() helper
>>   PM: domains: Make usage of device_wakeup_path() helper
>>   PM: core: Make usage of device_wakeup_path() helper
>>   i2c: stm32f7: Make usage of dev_wakeup_path() helper
> Please fold the patches into one and add the R-by from Ulf to it.

OK, the v2 is on the way.

Thanks

Patrice

>
> Thanks!

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

end of thread, other threads:[~2020-11-19  7:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06  7:33 [PATCH v1 0/4] PM: Add dev_wakeup_path() helper patrice.chotard
2020-11-06  7:33 ` [PATCH v1 1/4] PM / wakeup: " patrice.chotard
2020-11-06  7:33 ` [PATCH v1 2/4] PM: domains: Make usage of device_wakeup_path() helper patrice.chotard
2020-11-06  7:33 ` [PATCH v1 3/4] PM: core: " patrice.chotard
2020-11-06  7:33 ` [PATCH v1 4/4] i2c: stm32f7: Make usage of dev_wakeup_path() helper patrice.chotard
2020-11-06  9:46 ` [PATCH v1 0/4] PM: Add " Ulf Hansson
2020-11-18 13:08 ` Rafael J. Wysocki
2020-11-19  7:27   ` Patrice CHOTARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).