linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
@ 2023-10-10  7:51 Uwe Kleine-König
  2023-10-10  7:51 ` [PATCH 01/11] pwm: atmel-hlcdc: " Uwe Kleine-König
                   ` (6 more replies)
  0 siblings, 7 replies; 20+ messages in thread
From: Uwe Kleine-König @ 2023-10-10  7:51 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-pwm, Alexandre Belloni, linux-samsung-soc, Alim Akhtar,
	Florian Fainelli, Alexandre Torgue, Fabio Estevam, Sascha Hauer,
	Maxime Coquelin, Claudiu Beznea, Krzysztof Kozlowski,
	Fabrice Gasnier, Broadcom internal kernel review list,
	NXP Linux Team, kernel, Shawn Guo, linux-stm32, linux-arm-kernel

Hello,

Florian added pm support to the pwm-bcm2835 driver[1]. This made me
check what is the "modern" way to add pm support. This series modernizes
the other pwm drivers with the things I learned.

Best regards
Uwe

[1] https://lore.kernel.org/linux-pwm/20231009204226.3224521-1-florian.fainelli@broadcom.com

Uwe Kleine-König (11):
  pwm: atmel-hlcdc: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  pwm: atmel-tcb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  pwm: berlin: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  pwm: brcmstb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  pwm: dwc: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  pwm: imx-tpm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  pwm: samsung: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  pwm: stm32-lp: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  pwm: stm32: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  pwm: tiecap: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  pwm: tiehrpwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions

 drivers/pwm/pwm-atmel-hlcdc.c |  8 +++-----
 drivers/pwm/pwm-atmel-tcb.c   |  8 +++-----
 drivers/pwm/pwm-berlin.c      |  8 +++-----
 drivers/pwm/pwm-brcmstb.c     | 12 ++++--------
 drivers/pwm/pwm-dwc.c         |  6 ++----
 drivers/pwm/pwm-imx-tpm.c     | 10 +++++-----
 drivers/pwm/pwm-samsung.c     |  6 ++----
 drivers/pwm/pwm-stm32-lp.c    | 10 +++++-----
 drivers/pwm/pwm-stm32.c       |  8 ++++----
 drivers/pwm/pwm-tiecap.c      |  6 ++----
 drivers/pwm/pwm-tiehrpwm.c    |  8 +++-----
 11 files changed, 36 insertions(+), 54 deletions(-)

base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 01/11] pwm: atmel-hlcdc: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-10  7:51 [PATCH 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
@ 2023-10-10  7:51 ` Uwe Kleine-König
  2023-10-11 11:19   ` Jonathan Cameron
  2023-10-10  7:51 ` [PATCH 02/11] pwm: atmel-tcb: " Uwe Kleine-König
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Uwe Kleine-König @ 2023-10-10  7:51 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-pwm, Alexandre Belloni, Florian Fainelli, Claudiu Beznea,
	kernel, linux-arm-kernel

This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
care about when the functions are actually used, so the corresponding
#ifdef can be dropped.

Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
isn't enabled.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-atmel-hlcdc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c
index e271d920151e..95a806c7f623 100644
--- a/drivers/pwm/pwm-atmel-hlcdc.c
+++ b/drivers/pwm/pwm-atmel-hlcdc.c
@@ -181,7 +181,6 @@ static const struct atmel_hlcdc_pwm_errata atmel_hlcdc_pwm_sama5d3_errata = {
 	.div1_clk_erratum = true,
 };
 
-#ifdef CONFIG_PM_SLEEP
 static int atmel_hlcdc_pwm_suspend(struct device *dev)
 {
 	struct atmel_hlcdc_pwm *atmel = dev_get_drvdata(dev);
@@ -211,10 +210,9 @@ static int atmel_hlcdc_pwm_resume(struct device *dev)
 	return atmel_hlcdc_pwm_apply(&atmel->chip, &atmel->chip.pwms[0],
 				     &state);
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(atmel_hlcdc_pwm_pm_ops,
-			 atmel_hlcdc_pwm_suspend, atmel_hlcdc_pwm_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(atmel_hlcdc_pwm_pm_ops,
+				atmel_hlcdc_pwm_suspend, atmel_hlcdc_pwm_resume);
 
 static const struct of_device_id atmel_hlcdc_dt_ids[] = {
 	{
@@ -298,7 +296,7 @@ static struct platform_driver atmel_hlcdc_pwm_driver = {
 	.driver = {
 		.name = "atmel-hlcdc-pwm",
 		.of_match_table = atmel_hlcdc_pwm_dt_ids,
-		.pm = &atmel_hlcdc_pwm_pm_ops,
+		.pm = pm_ptr(&atmel_hlcdc_pwm_pm_ops),
 	},
 	.probe = atmel_hlcdc_pwm_probe,
 	.remove_new = atmel_hlcdc_pwm_remove,
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 02/11] pwm: atmel-tcb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-10  7:51 [PATCH 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
  2023-10-10  7:51 ` [PATCH 01/11] pwm: atmel-hlcdc: " Uwe Kleine-König
@ 2023-10-10  7:51 ` Uwe Kleine-König
  2023-10-11 11:20   ` Jonathan Cameron
  2023-10-10  7:51 ` [PATCH 04/11] pwm: brcmstb: " Uwe Kleine-König
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Uwe Kleine-König @ 2023-10-10  7:51 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-pwm, Alexandre Belloni, Florian Fainelli, Claudiu Beznea,
	kernel, linux-arm-kernel

This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
care about when the functions are actually used, so the corresponding
#ifdef can be dropped.

Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
isn't enabled.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-atmel-tcb.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
index c00dd37c5fbd..a2be4cb4c073 100644
--- a/drivers/pwm/pwm-atmel-tcb.c
+++ b/drivers/pwm/pwm-atmel-tcb.c
@@ -490,7 +490,6 @@ static const struct of_device_id atmel_tcb_pwm_dt_ids[] = {
 };
 MODULE_DEVICE_TABLE(of, atmel_tcb_pwm_dt_ids);
 
-#ifdef CONFIG_PM_SLEEP
 static int atmel_tcb_pwm_suspend(struct device *dev)
 {
 	struct atmel_tcb_pwm_chip *tcbpwm = dev_get_drvdata(dev);
@@ -523,16 +522,15 @@ static int atmel_tcb_pwm_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(atmel_tcb_pwm_pm_ops, atmel_tcb_pwm_suspend,
-			 atmel_tcb_pwm_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(atmel_tcb_pwm_pm_ops, atmel_tcb_pwm_suspend,
+				atmel_tcb_pwm_resume);
 
 static struct platform_driver atmel_tcb_pwm_driver = {
 	.driver = {
 		.name = "atmel-tcb-pwm",
 		.of_match_table = atmel_tcb_pwm_dt_ids,
-		.pm = &atmel_tcb_pwm_pm_ops,
+		.pm = pm_ptr(&atmel_tcb_pwm_pm_ops),
 	},
 	.probe = atmel_tcb_pwm_probe,
 	.remove_new = atmel_tcb_pwm_remove,
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 04/11] pwm: brcmstb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-10  7:51 [PATCH 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
  2023-10-10  7:51 ` [PATCH 01/11] pwm: atmel-hlcdc: " Uwe Kleine-König
  2023-10-10  7:51 ` [PATCH 02/11] pwm: atmel-tcb: " Uwe Kleine-König
@ 2023-10-10  7:51 ` Uwe Kleine-König
  2023-10-11 11:21   ` Jonathan Cameron
  2023-10-11 16:48   ` Florian Fainelli
  2023-10-10  7:51 ` [PATCH 06/11] pwm: imx-tpm: " Uwe Kleine-König
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 20+ messages in thread
From: Uwe Kleine-König @ 2023-10-10  7:51 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Florian Fainelli, Broadcom internal kernel review list, linux-pwm,
	linux-arm-kernel, kernel

This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
care about when the functions are actually used, so the corresponding
#ifdef can be dropped.

Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
isn't enabled.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-brcmstb.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/pwm/pwm-brcmstb.c b/drivers/pwm/pwm-brcmstb.c
index a3faa9a3de7c..7510b85dd9dd 100644
--- a/drivers/pwm/pwm-brcmstb.c
+++ b/drivers/pwm/pwm-brcmstb.c
@@ -283,7 +283,6 @@ static void brcmstb_pwm_remove(struct platform_device *pdev)
 	clk_disable_unprepare(p->clk);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int brcmstb_pwm_suspend(struct device *dev)
 {
 	struct brcmstb_pwm *p = dev_get_drvdata(dev);
@@ -297,14 +296,11 @@ static int brcmstb_pwm_resume(struct device *dev)
 {
 	struct brcmstb_pwm *p = dev_get_drvdata(dev);
 
-	clk_enable(p->clk);
-
-	return 0;
+	return clk_enable(p->clk);
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(brcmstb_pwm_pm_ops, brcmstb_pwm_suspend,
-			 brcmstb_pwm_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(brcmstb_pwm_pm_ops, brcmstb_pwm_suspend,
+				brcmstb_pwm_resume);
 
 static struct platform_driver brcmstb_pwm_driver = {
 	.probe = brcmstb_pwm_probe,
@@ -312,7 +308,7 @@ static struct platform_driver brcmstb_pwm_driver = {
 	.driver = {
 		.name = "pwm-brcmstb",
 		.of_match_table = brcmstb_pwm_of_match,
-		.pm = &brcmstb_pwm_pm_ops,
+		.pm = pm_ptr(&brcmstb_pwm_pm_ops),
 	},
 };
 module_platform_driver(brcmstb_pwm_driver);
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 06/11] pwm: imx-tpm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-10  7:51 [PATCH 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
                   ` (2 preceding siblings ...)
  2023-10-10  7:51 ` [PATCH 04/11] pwm: brcmstb: " Uwe Kleine-König
@ 2023-10-10  7:51 ` Uwe Kleine-König
  2023-10-11 11:22   ` Jonathan Cameron
  2023-10-10  7:51 ` [PATCH 07/11] pwm: samsung: " Uwe Kleine-König
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Uwe Kleine-König @ 2023-10-10  7:51 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Shawn Guo, Sascha Hauer, Fabio Estevam, NXP Linux Team, linux-pwm,
	linux-arm-kernel, kernel, Florian Fainelli

This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
care about when the functions are actually used, so the corresponding
__maybe_unused can be dropped.

Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
isn't enabled.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-imx-tpm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/pwm/pwm-imx-tpm.c b/drivers/pwm/pwm-imx-tpm.c
index 98ab65c89685..da22f9bb367e 100644
--- a/drivers/pwm/pwm-imx-tpm.c
+++ b/drivers/pwm/pwm-imx-tpm.c
@@ -390,7 +390,7 @@ static void pwm_imx_tpm_remove(struct platform_device *pdev)
 	clk_disable_unprepare(tpm->clk);
 }
 
-static int __maybe_unused pwm_imx_tpm_suspend(struct device *dev)
+static int pwm_imx_tpm_suspend(struct device *dev)
 {
 	struct imx_tpm_pwm_chip *tpm = dev_get_drvdata(dev);
 
@@ -409,7 +409,7 @@ static int __maybe_unused pwm_imx_tpm_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused pwm_imx_tpm_resume(struct device *dev)
+static int pwm_imx_tpm_resume(struct device *dev)
 {
 	struct imx_tpm_pwm_chip *tpm = dev_get_drvdata(dev);
 	int ret = 0;
@@ -421,8 +421,8 @@ static int __maybe_unused pwm_imx_tpm_resume(struct device *dev)
 	return ret;
 }
 
-static SIMPLE_DEV_PM_OPS(imx_tpm_pwm_pm,
-			 pwm_imx_tpm_suspend, pwm_imx_tpm_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(imx_tpm_pwm_pm,
+				pwm_imx_tpm_suspend, pwm_imx_tpm_resume);
 
 static const struct of_device_id imx_tpm_pwm_dt_ids[] = {
 	{ .compatible = "fsl,imx7ulp-pwm", },
@@ -434,7 +434,7 @@ static struct platform_driver imx_tpm_pwm_driver = {
 	.driver = {
 		.name = "imx7ulp-tpm-pwm",
 		.of_match_table = imx_tpm_pwm_dt_ids,
-		.pm = &imx_tpm_pwm_pm,
+		.pm = pm_ptr(&imx_tpm_pwm_pm),
 	},
 	.probe	= pwm_imx_tpm_probe,
 	.remove_new = pwm_imx_tpm_remove,
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 07/11] pwm: samsung: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-10  7:51 [PATCH 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
                   ` (3 preceding siblings ...)
  2023-10-10  7:51 ` [PATCH 06/11] pwm: imx-tpm: " Uwe Kleine-König
@ 2023-10-10  7:51 ` Uwe Kleine-König
  2023-10-11 11:22   ` Jonathan Cameron
  2023-10-10  7:51 ` [PATCH 08/11] pwm: stm32-lp: " Uwe Kleine-König
  2023-10-10  7:51 ` [PATCH 09/11] pwm: stm32: " Uwe Kleine-König
  6 siblings, 1 reply; 20+ messages in thread
From: Uwe Kleine-König @ 2023-10-10  7:51 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Krzysztof Kozlowski, Alim Akhtar, linux-arm-kernel,
	linux-samsung-soc, linux-pwm, kernel, Florian Fainelli

This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
care about when the functions are actually used, so the corresponding
#ifdef can be dropped.

Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
isn't enabled.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-samsung.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
index e8828f57ab15..041e2f9476ff 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c
@@ -630,7 +630,6 @@ static void pwm_samsung_remove(struct platform_device *pdev)
 	clk_disable_unprepare(chip->base_clk);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int pwm_samsung_resume(struct device *dev)
 {
 	struct samsung_pwm_chip *our_chip = dev_get_drvdata(dev);
@@ -663,14 +662,13 @@ static int pwm_samsung_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(pwm_samsung_pm_ops, NULL, pwm_samsung_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(pwm_samsung_pm_ops, NULL, pwm_samsung_resume);
 
 static struct platform_driver pwm_samsung_driver = {
 	.driver		= {
 		.name	= "samsung-pwm",
-		.pm	= &pwm_samsung_pm_ops,
+		.pm	= pm_ptr(&pwm_samsung_pm_ops),
 		.of_match_table = of_match_ptr(samsung_pwm_matches),
 	},
 	.probe		= pwm_samsung_probe,
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 08/11] pwm: stm32-lp: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-10  7:51 [PATCH 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
                   ` (4 preceding siblings ...)
  2023-10-10  7:51 ` [PATCH 07/11] pwm: samsung: " Uwe Kleine-König
@ 2023-10-10  7:51 ` Uwe Kleine-König
  2023-10-11 11:23   ` Jonathan Cameron
  2023-10-10  7:51 ` [PATCH 09/11] pwm: stm32: " Uwe Kleine-König
  6 siblings, 1 reply; 20+ messages in thread
From: Uwe Kleine-König @ 2023-10-10  7:51 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Fabrice Gasnier, Maxime Coquelin, Alexandre Torgue, linux-pwm,
	linux-stm32, linux-arm-kernel, kernel, Florian Fainelli

This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
care about when the functions are actually used, so the corresponding
__maybe_unused can be dropped.

Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
isn't enabled.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-stm32-lp.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c
index bb3a045a7334..ac00f9224bda 100644
--- a/drivers/pwm/pwm-stm32-lp.c
+++ b/drivers/pwm/pwm-stm32-lp.c
@@ -219,7 +219,7 @@ static int stm32_pwm_lp_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int __maybe_unused stm32_pwm_lp_suspend(struct device *dev)
+static int stm32_pwm_lp_suspend(struct device *dev)
 {
 	struct stm32_pwm_lp *priv = dev_get_drvdata(dev);
 	struct pwm_state state;
@@ -234,13 +234,13 @@ static int __maybe_unused stm32_pwm_lp_suspend(struct device *dev)
 	return pinctrl_pm_select_sleep_state(dev);
 }
 
-static int __maybe_unused stm32_pwm_lp_resume(struct device *dev)
+static int stm32_pwm_lp_resume(struct device *dev)
 {
 	return pinctrl_pm_select_default_state(dev);
 }
 
-static SIMPLE_DEV_PM_OPS(stm32_pwm_lp_pm_ops, stm32_pwm_lp_suspend,
-			 stm32_pwm_lp_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(stm32_pwm_lp_pm_ops, stm32_pwm_lp_suspend,
+				stm32_pwm_lp_resume);
 
 static const struct of_device_id stm32_pwm_lp_of_match[] = {
 	{ .compatible = "st,stm32-pwm-lp", },
@@ -253,7 +253,7 @@ static struct platform_driver stm32_pwm_lp_driver = {
 	.driver	= {
 		.name = "stm32-pwm-lp",
 		.of_match_table = stm32_pwm_lp_of_match,
-		.pm = &stm32_pwm_lp_pm_ops,
+		.pm = pm_ptr(&stm32_pwm_lp_pm_ops),
 	},
 };
 module_platform_driver(stm32_pwm_lp_driver);
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 09/11] pwm: stm32: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-10  7:51 [PATCH 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
                   ` (5 preceding siblings ...)
  2023-10-10  7:51 ` [PATCH 08/11] pwm: stm32-lp: " Uwe Kleine-König
@ 2023-10-10  7:51 ` Uwe Kleine-König
  2023-10-11 11:23   ` Jonathan Cameron
  6 siblings, 1 reply; 20+ messages in thread
From: Uwe Kleine-König @ 2023-10-10  7:51 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Fabrice Gasnier, Maxime Coquelin, Alexandre Torgue, linux-pwm,
	linux-stm32, linux-arm-kernel, kernel, Florian Fainelli

This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
care about when the functions are actually used, so the corresponding
__maybe_unused can be dropped.

Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
isn't enabled.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-stm32.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
index 3d6be7749e23..a9c7b5b6ab23 100644
--- a/drivers/pwm/pwm-stm32.c
+++ b/drivers/pwm/pwm-stm32.c
@@ -646,7 +646,7 @@ static int stm32_pwm_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int __maybe_unused stm32_pwm_suspend(struct device *dev)
+static int stm32_pwm_suspend(struct device *dev)
 {
 	struct stm32_pwm *priv = dev_get_drvdata(dev);
 	unsigned int i;
@@ -667,7 +667,7 @@ static int __maybe_unused stm32_pwm_suspend(struct device *dev)
 	return pinctrl_pm_select_sleep_state(dev);
 }
 
-static int __maybe_unused stm32_pwm_resume(struct device *dev)
+static int stm32_pwm_resume(struct device *dev)
 {
 	struct stm32_pwm *priv = dev_get_drvdata(dev);
 	int ret;
@@ -680,7 +680,7 @@ static int __maybe_unused stm32_pwm_resume(struct device *dev)
 	return stm32_pwm_apply_breakinputs(priv);
 }
 
-static SIMPLE_DEV_PM_OPS(stm32_pwm_pm_ops, stm32_pwm_suspend, stm32_pwm_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(stm32_pwm_pm_ops, stm32_pwm_suspend, stm32_pwm_resume);
 
 static const struct of_device_id stm32_pwm_of_match[] = {
 	{ .compatible = "st,stm32-pwm",	},
@@ -693,7 +693,7 @@ static struct platform_driver stm32_pwm_driver = {
 	.driver	= {
 		.name = "stm32-pwm",
 		.of_match_table = stm32_pwm_of_match,
-		.pm = &stm32_pwm_pm_ops,
+		.pm = pm_ptr(&stm32_pwm_pm_ops),
 	},
 };
 module_platform_driver(stm32_pwm_driver);
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 01/11] pwm: atmel-hlcdc: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-10  7:51 ` [PATCH 01/11] pwm: atmel-hlcdc: " Uwe Kleine-König
@ 2023-10-11 11:19   ` Jonathan Cameron
  0 siblings, 0 replies; 20+ messages in thread
From: Jonathan Cameron @ 2023-10-11 11:19 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, linux-pwm, Alexandre Belloni, Florian Fainelli,
	Claudiu Beznea, kernel, linux-arm-kernel

On Tue, 10 Oct 2023 09:51:02 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

> This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
> care about when the functions are actually used, so the corresponding
> #ifdef can be dropped.
> 
> Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> isn't enabled.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
>  drivers/pwm/pwm-atmel-hlcdc.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c
> index e271d920151e..95a806c7f623 100644
> --- a/drivers/pwm/pwm-atmel-hlcdc.c
> +++ b/drivers/pwm/pwm-atmel-hlcdc.c
> @@ -181,7 +181,6 @@ static const struct atmel_hlcdc_pwm_errata atmel_hlcdc_pwm_sama5d3_errata = {
>  	.div1_clk_erratum = true,
>  };
>  
> -#ifdef CONFIG_PM_SLEEP
>  static int atmel_hlcdc_pwm_suspend(struct device *dev)
>  {
>  	struct atmel_hlcdc_pwm *atmel = dev_get_drvdata(dev);
> @@ -211,10 +210,9 @@ static int atmel_hlcdc_pwm_resume(struct device *dev)
>  	return atmel_hlcdc_pwm_apply(&atmel->chip, &atmel->chip.pwms[0],
>  				     &state);
>  }
> -#endif
>  
> -static SIMPLE_DEV_PM_OPS(atmel_hlcdc_pwm_pm_ops,
> -			 atmel_hlcdc_pwm_suspend, atmel_hlcdc_pwm_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(atmel_hlcdc_pwm_pm_ops,
> +				atmel_hlcdc_pwm_suspend, atmel_hlcdc_pwm_resume);
>  
>  static const struct of_device_id atmel_hlcdc_dt_ids[] = {
>  	{
> @@ -298,7 +296,7 @@ static struct platform_driver atmel_hlcdc_pwm_driver = {
>  	.driver = {
>  		.name = "atmel-hlcdc-pwm",
>  		.of_match_table = atmel_hlcdc_pwm_dt_ids,
> -		.pm = &atmel_hlcdc_pwm_pm_ops,
> +		.pm = pm_ptr(&atmel_hlcdc_pwm_pm_ops),
>  	},
>  	.probe = atmel_hlcdc_pwm_probe,
>  	.remove_new = atmel_hlcdc_pwm_remove,


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 02/11] pwm: atmel-tcb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-10  7:51 ` [PATCH 02/11] pwm: atmel-tcb: " Uwe Kleine-König
@ 2023-10-11 11:20   ` Jonathan Cameron
  0 siblings, 0 replies; 20+ messages in thread
From: Jonathan Cameron @ 2023-10-11 11:20 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, linux-pwm, Alexandre Belloni, Florian Fainelli,
	Claudiu Beznea, kernel, linux-arm-kernel

On Tue, 10 Oct 2023 09:51:03 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

> This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
> care about when the functions are actually used, so the corresponding
> #ifdef can be dropped.
> 
> Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> isn't enabled.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

I did a lot of these so I still have how it works fresh in my mind
making review hopefully easy :)

> ---
>  drivers/pwm/pwm-atmel-tcb.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
> index c00dd37c5fbd..a2be4cb4c073 100644
> --- a/drivers/pwm/pwm-atmel-tcb.c
> +++ b/drivers/pwm/pwm-atmel-tcb.c
> @@ -490,7 +490,6 @@ static const struct of_device_id atmel_tcb_pwm_dt_ids[] = {
>  };
>  MODULE_DEVICE_TABLE(of, atmel_tcb_pwm_dt_ids);
>  
> -#ifdef CONFIG_PM_SLEEP
>  static int atmel_tcb_pwm_suspend(struct device *dev)
>  {
>  	struct atmel_tcb_pwm_chip *tcbpwm = dev_get_drvdata(dev);
> @@ -523,16 +522,15 @@ static int atmel_tcb_pwm_resume(struct device *dev)
>  
>  	return 0;
>  }
> -#endif
>  
> -static SIMPLE_DEV_PM_OPS(atmel_tcb_pwm_pm_ops, atmel_tcb_pwm_suspend,
> -			 atmel_tcb_pwm_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(atmel_tcb_pwm_pm_ops, atmel_tcb_pwm_suspend,
> +				atmel_tcb_pwm_resume);
>  
>  static struct platform_driver atmel_tcb_pwm_driver = {
>  	.driver = {
>  		.name = "atmel-tcb-pwm",
>  		.of_match_table = atmel_tcb_pwm_dt_ids,
> -		.pm = &atmel_tcb_pwm_pm_ops,
> +		.pm = pm_ptr(&atmel_tcb_pwm_pm_ops),
>  	},
>  	.probe = atmel_tcb_pwm_probe,
>  	.remove_new = atmel_tcb_pwm_remove,


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 04/11] pwm: brcmstb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-10  7:51 ` [PATCH 04/11] pwm: brcmstb: " Uwe Kleine-König
@ 2023-10-11 11:21   ` Jonathan Cameron
  2023-10-11 15:31     ` Uwe Kleine-König
  2023-10-11 16:48   ` Florian Fainelli
  1 sibling, 1 reply; 20+ messages in thread
From: Jonathan Cameron @ 2023-10-11 11:21 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, Florian Fainelli,
	Broadcom internal kernel review list, linux-pwm, linux-arm-kernel,
	kernel

On Tue, 10 Oct 2023 09:51:05 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

> This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
> care about when the functions are actually used, so the corresponding
> #ifdef can be dropped.
> 
> Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> isn't enabled.

The additional change to potentially return an error when not doing so before
wants to be called out in the description.

> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/pwm/pwm-brcmstb.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-brcmstb.c b/drivers/pwm/pwm-brcmstb.c
> index a3faa9a3de7c..7510b85dd9dd 100644
> --- a/drivers/pwm/pwm-brcmstb.c
> +++ b/drivers/pwm/pwm-brcmstb.c
> @@ -283,7 +283,6 @@ static void brcmstb_pwm_remove(struct platform_device *pdev)
>  	clk_disable_unprepare(p->clk);
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
>  static int brcmstb_pwm_suspend(struct device *dev)
>  {
>  	struct brcmstb_pwm *p = dev_get_drvdata(dev);
> @@ -297,14 +296,11 @@ static int brcmstb_pwm_resume(struct device *dev)
>  {
>  	struct brcmstb_pwm *p = dev_get_drvdata(dev);
>  
> -	clk_enable(p->clk);
> -
> -	return 0;
> +	return clk_enable(p->clk);
>  }
> -#endif
>  
> -static SIMPLE_DEV_PM_OPS(brcmstb_pwm_pm_ops, brcmstb_pwm_suspend,
> -			 brcmstb_pwm_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(brcmstb_pwm_pm_ops, brcmstb_pwm_suspend,
> +				brcmstb_pwm_resume);
>  
>  static struct platform_driver brcmstb_pwm_driver = {
>  	.probe = brcmstb_pwm_probe,
> @@ -312,7 +308,7 @@ static struct platform_driver brcmstb_pwm_driver = {
>  	.driver = {
>  		.name = "pwm-brcmstb",
>  		.of_match_table = brcmstb_pwm_of_match,
> -		.pm = &brcmstb_pwm_pm_ops,
> +		.pm = pm_ptr(&brcmstb_pwm_pm_ops),
>  	},
>  };
>  module_platform_driver(brcmstb_pwm_driver);


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 06/11] pwm: imx-tpm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-10  7:51 ` [PATCH 06/11] pwm: imx-tpm: " Uwe Kleine-König
@ 2023-10-11 11:22   ` Jonathan Cameron
  0 siblings, 0 replies; 20+ messages in thread
From: Jonathan Cameron @ 2023-10-11 11:22 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, Shawn Guo, Sascha Hauer, Fabio Estevam,
	NXP Linux Team, linux-pwm, linux-arm-kernel, kernel,
	Florian Fainelli

On Tue, 10 Oct 2023 09:51:07 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

> This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
> care about when the functions are actually used, so the corresponding
> __maybe_unused can be dropped.
> 
> Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> isn't enabled.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
>  drivers/pwm/pwm-imx-tpm.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-imx-tpm.c b/drivers/pwm/pwm-imx-tpm.c
> index 98ab65c89685..da22f9bb367e 100644
> --- a/drivers/pwm/pwm-imx-tpm.c
> +++ b/drivers/pwm/pwm-imx-tpm.c
> @@ -390,7 +390,7 @@ static void pwm_imx_tpm_remove(struct platform_device *pdev)
>  	clk_disable_unprepare(tpm->clk);
>  }
>  
> -static int __maybe_unused pwm_imx_tpm_suspend(struct device *dev)
> +static int pwm_imx_tpm_suspend(struct device *dev)
>  {
>  	struct imx_tpm_pwm_chip *tpm = dev_get_drvdata(dev);
>  
> @@ -409,7 +409,7 @@ static int __maybe_unused pwm_imx_tpm_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int __maybe_unused pwm_imx_tpm_resume(struct device *dev)
> +static int pwm_imx_tpm_resume(struct device *dev)
>  {
>  	struct imx_tpm_pwm_chip *tpm = dev_get_drvdata(dev);
>  	int ret = 0;
> @@ -421,8 +421,8 @@ static int __maybe_unused pwm_imx_tpm_resume(struct device *dev)
>  	return ret;
>  }
>  
> -static SIMPLE_DEV_PM_OPS(imx_tpm_pwm_pm,
> -			 pwm_imx_tpm_suspend, pwm_imx_tpm_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(imx_tpm_pwm_pm,
> +				pwm_imx_tpm_suspend, pwm_imx_tpm_resume);
>  
>  static const struct of_device_id imx_tpm_pwm_dt_ids[] = {
>  	{ .compatible = "fsl,imx7ulp-pwm", },
> @@ -434,7 +434,7 @@ static struct platform_driver imx_tpm_pwm_driver = {
>  	.driver = {
>  		.name = "imx7ulp-tpm-pwm",
>  		.of_match_table = imx_tpm_pwm_dt_ids,
> -		.pm = &imx_tpm_pwm_pm,
> +		.pm = pm_ptr(&imx_tpm_pwm_pm),
>  	},
>  	.probe	= pwm_imx_tpm_probe,
>  	.remove_new = pwm_imx_tpm_remove,


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 07/11] pwm: samsung: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-10  7:51 ` [PATCH 07/11] pwm: samsung: " Uwe Kleine-König
@ 2023-10-11 11:22   ` Jonathan Cameron
  0 siblings, 0 replies; 20+ messages in thread
From: Jonathan Cameron @ 2023-10-11 11:22 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, Krzysztof Kozlowski, Alim Akhtar,
	linux-arm-kernel, linux-samsung-soc, linux-pwm, kernel,
	Florian Fainelli

On Tue, 10 Oct 2023 09:51:08 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

> This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
> care about when the functions are actually used, so the corresponding
> #ifdef can be dropped.
> 
> Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> isn't enabled.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
>  drivers/pwm/pwm-samsung.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
> index e8828f57ab15..041e2f9476ff 100644
> --- a/drivers/pwm/pwm-samsung.c
> +++ b/drivers/pwm/pwm-samsung.c
> @@ -630,7 +630,6 @@ static void pwm_samsung_remove(struct platform_device *pdev)
>  	clk_disable_unprepare(chip->base_clk);
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
>  static int pwm_samsung_resume(struct device *dev)
>  {
>  	struct samsung_pwm_chip *our_chip = dev_get_drvdata(dev);
> @@ -663,14 +662,13 @@ static int pwm_samsung_resume(struct device *dev)
>  
>  	return 0;
>  }
> -#endif
>  
> -static SIMPLE_DEV_PM_OPS(pwm_samsung_pm_ops, NULL, pwm_samsung_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(pwm_samsung_pm_ops, NULL, pwm_samsung_resume);
>  
>  static struct platform_driver pwm_samsung_driver = {
>  	.driver		= {
>  		.name	= "samsung-pwm",
> -		.pm	= &pwm_samsung_pm_ops,
> +		.pm	= pm_ptr(&pwm_samsung_pm_ops),
>  		.of_match_table = of_match_ptr(samsung_pwm_matches),
>  	},
>  	.probe		= pwm_samsung_probe,


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 08/11] pwm: stm32-lp: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-10  7:51 ` [PATCH 08/11] pwm: stm32-lp: " Uwe Kleine-König
@ 2023-10-11 11:23   ` Jonathan Cameron
  0 siblings, 0 replies; 20+ messages in thread
From: Jonathan Cameron @ 2023-10-11 11:23 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, Fabrice Gasnier, Maxime Coquelin,
	Alexandre Torgue, linux-pwm, linux-stm32, linux-arm-kernel,
	kernel, Florian Fainelli

On Tue, 10 Oct 2023 09:51:09 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

> This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
> care about when the functions are actually used, so the corresponding
> __maybe_unused can be dropped.
> 
> Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> isn't enabled.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 09/11] pwm: stm32: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-10  7:51 ` [PATCH 09/11] pwm: stm32: " Uwe Kleine-König
@ 2023-10-11 11:23   ` Jonathan Cameron
  0 siblings, 0 replies; 20+ messages in thread
From: Jonathan Cameron @ 2023-10-11 11:23 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, Fabrice Gasnier, Maxime Coquelin,
	Alexandre Torgue, linux-pwm, linux-stm32, linux-arm-kernel,
	kernel, Florian Fainelli

On Tue, 10 Oct 2023 09:51:10 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

> This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
> care about when the functions are actually used, so the corresponding
> __maybe_unused can be dropped.
> 
> Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> isn't enabled.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 04/11] pwm: brcmstb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-11 11:21   ` Jonathan Cameron
@ 2023-10-11 15:31     ` Uwe Kleine-König
  2023-10-11 15:42       ` Florian Fainelli
  0 siblings, 1 reply; 20+ messages in thread
From: Uwe Kleine-König @ 2023-10-11 15:31 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-pwm, Florian Fainelli, Thierry Reding,
	Broadcom internal kernel review list, kernel, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1401 bytes --]

On Wed, Oct 11, 2023 at 12:21:52PM +0100, Jonathan Cameron wrote:
> On Tue, 10 Oct 2023 09:51:05 +0200
> Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> 
> > This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
> > care about when the functions are actually used, so the corresponding
> > #ifdef can be dropped.
> > 
> > Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> > isn't enabled.
> 
> The additional change to potentially return an error when not doing so before
> wants to be called out in the description.

Indeed, good catch. Something like:

	pwm: brcmstb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM

	This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
	care about when the functions are actually used, so the corresponding
	#ifdef can be dropped.

	Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
	isn't enabled.

	While touching brcmstb_pwm_suspend() also propagate the return
	value of clk_enable() to the caller of .suspend().

	Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

I fixed that in my tree, so if and when v2 happens, this comment will be
addressed.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 04/11] pwm: brcmstb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-11 15:31     ` Uwe Kleine-König
@ 2023-10-11 15:42       ` Florian Fainelli
  2023-10-11 16:48         ` Uwe Kleine-König
  0 siblings, 1 reply; 20+ messages in thread
From: Florian Fainelli @ 2023-10-11 15:42 UTC (permalink / raw)
  To: Uwe Kleine-König, Jonathan Cameron
  Cc: linux-pwm, Thierry Reding, Broadcom internal kernel review list,
	kernel, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1580 bytes --]



On 10/11/2023 8:31 AM, Uwe Kleine-König wrote:
> On Wed, Oct 11, 2023 at 12:21:52PM +0100, Jonathan Cameron wrote:
>> On Tue, 10 Oct 2023 09:51:05 +0200
>> Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
>>
>>> This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
>>> care about when the functions are actually used, so the corresponding
>>> #ifdef can be dropped.
>>>
>>> Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
>>> isn't enabled.
>>
>> The additional change to potentially return an error when not doing so before
>> wants to be called out in the description.
> 
> Indeed, good catch. Something like:
> 
> 	pwm: brcmstb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM
> 
> 	This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
> 	care about when the functions are actually used, so the corresponding
> 	#ifdef can be dropped.
> 
> 	Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> 	isn't enabled.
> 
> 	While touching brcmstb_pwm_suspend() also propagate the return
> 	value of clk_enable() to the caller of .suspend().
> 
> 	Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> I fixed that in my tree, so if and when v2 happens, this comment will be
> addressed.

OK so that makes:

https://lore.kernel.org/all/20231005164728.1846726-1-florian.fainelli@broadcom.com/

void, and now I also need to re-submit:

https://lore.kernel.org/all/20231004175414.1738475-1-florian.fainelli@broadcom.com/

or is Thierry going to resolve that conflict for us?
-- 
Florian

[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 04/11] pwm: brcmstb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-11 15:42       ` Florian Fainelli
@ 2023-10-11 16:48         ` Uwe Kleine-König
  2023-10-13 13:35           ` Thierry Reding
  0 siblings, 1 reply; 20+ messages in thread
From: Uwe Kleine-König @ 2023-10-11 16:48 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Jonathan Cameron, linux-pwm, Thierry Reding,
	Broadcom internal kernel review list, linux-arm-kernel, kernel


[-- Attachment #1.1: Type: text/plain, Size: 2107 bytes --]

On Wed, Oct 11, 2023 at 08:42:54AM -0700, Florian Fainelli wrote:
> 
> 
> On 10/11/2023 8:31 AM, Uwe Kleine-König wrote:
> > On Wed, Oct 11, 2023 at 12:21:52PM +0100, Jonathan Cameron wrote:
> > > On Tue, 10 Oct 2023 09:51:05 +0200
> > > Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> > > 
> > > > This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
> > > > care about when the functions are actually used, so the corresponding
> > > > #ifdef can be dropped.
> > > > 
> > > > Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> > > > isn't enabled.
> > > 
> > > The additional change to potentially return an error when not doing so before
> > > wants to be called out in the description.
> > 
> > Indeed, good catch. Something like:
> > 
> > 	pwm: brcmstb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM
> > 
> > 	This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
> > 	care about when the functions are actually used, so the corresponding
> > 	#ifdef can be dropped.
> > 
> > 	Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> > 	isn't enabled.
> > 
> > 	While touching brcmstb_pwm_suspend() also propagate the return
> > 	value of clk_enable() to the caller of .suspend().
> > 
> > 	Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > 
> > I fixed that in my tree, so if and when v2 happens, this comment will be
> > addressed.
> 
> OK so that makes:
> 
> https://lore.kernel.org/all/20231005164728.1846726-1-florian.fainelli@broadcom.com/
> 
> void, and now I also need to re-submit:
> 
> https://lore.kernel.org/all/20231004175414.1738475-1-florian.fainelli@broadcom.com/
> 
> or is Thierry going to resolve that conflict for us?

Oh right, I remember.

@Thierry: Please drop my patch and take Florian's instead. I mark my
patch as rejected.

@Florian: Sorry!

Best regards
Uwe


-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 04/11] pwm: brcmstb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-10  7:51 ` [PATCH 04/11] pwm: brcmstb: " Uwe Kleine-König
  2023-10-11 11:21   ` Jonathan Cameron
@ 2023-10-11 16:48   ` Florian Fainelli
  1 sibling, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2023-10-11 16:48 UTC (permalink / raw)
  To: Uwe Kleine-König, Thierry Reding
  Cc: Broadcom internal kernel review list, linux-pwm, linux-arm-kernel,
	kernel


[-- Attachment #1.1: Type: text/plain, Size: 454 bytes --]

On 10/10/23 00:51, Uwe Kleine-König wrote:
> This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
> care about when the functions are actually used, so the corresponding
> #ifdef can be dropped.
> 
> Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> isn't enabled.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian


[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 04/11] pwm: brcmstb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-11 16:48         ` Uwe Kleine-König
@ 2023-10-13 13:35           ` Thierry Reding
  0 siblings, 0 replies; 20+ messages in thread
From: Thierry Reding @ 2023-10-13 13:35 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Florian Fainelli, Jonathan Cameron, linux-pwm,
	Broadcom internal kernel review list, linux-arm-kernel, kernel


[-- Attachment #1.1: Type: text/plain, Size: 2231 bytes --]

On Wed, Oct 11, 2023 at 06:48:10PM +0200, Uwe Kleine-König wrote:
> On Wed, Oct 11, 2023 at 08:42:54AM -0700, Florian Fainelli wrote:
> > 
> > 
> > On 10/11/2023 8:31 AM, Uwe Kleine-König wrote:
> > > On Wed, Oct 11, 2023 at 12:21:52PM +0100, Jonathan Cameron wrote:
> > > > On Tue, 10 Oct 2023 09:51:05 +0200
> > > > Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> > > > 
> > > > > This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
> > > > > care about when the functions are actually used, so the corresponding
> > > > > #ifdef can be dropped.
> > > > > 
> > > > > Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> > > > > isn't enabled.
> > > > 
> > > > The additional change to potentially return an error when not doing so before
> > > > wants to be called out in the description.
> > > 
> > > Indeed, good catch. Something like:
> > > 
> > > 	pwm: brcmstb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM
> > > 
> > > 	This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
> > > 	care about when the functions are actually used, so the corresponding
> > > 	#ifdef can be dropped.
> > > 
> > > 	Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> > > 	isn't enabled.
> > > 
> > > 	While touching brcmstb_pwm_suspend() also propagate the return
> > > 	value of clk_enable() to the caller of .suspend().
> > > 
> > > 	Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > > 
> > > I fixed that in my tree, so if and when v2 happens, this comment will be
> > > addressed.
> > 
> > OK so that makes:
> > 
> > https://lore.kernel.org/all/20231005164728.1846726-1-florian.fainelli@broadcom.com/
> > 
> > void, and now I also need to re-submit:
> > 
> > https://lore.kernel.org/all/20231004175414.1738475-1-florian.fainelli@broadcom.com/
> > 
> > or is Thierry going to resolve that conflict for us?
> 
> Oh right, I remember.
> 
> @Thierry: Please drop my patch and take Florian's instead. I mark my
> patch as rejected.

This series doesn't apply anymore anyway, so can you please rebase this
on top of the PWM for-next branch and resend the series?

Thanks,
Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2023-10-13 13:36 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-10  7:51 [PATCH 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
2023-10-10  7:51 ` [PATCH 01/11] pwm: atmel-hlcdc: " Uwe Kleine-König
2023-10-11 11:19   ` Jonathan Cameron
2023-10-10  7:51 ` [PATCH 02/11] pwm: atmel-tcb: " Uwe Kleine-König
2023-10-11 11:20   ` Jonathan Cameron
2023-10-10  7:51 ` [PATCH 04/11] pwm: brcmstb: " Uwe Kleine-König
2023-10-11 11:21   ` Jonathan Cameron
2023-10-11 15:31     ` Uwe Kleine-König
2023-10-11 15:42       ` Florian Fainelli
2023-10-11 16:48         ` Uwe Kleine-König
2023-10-13 13:35           ` Thierry Reding
2023-10-11 16:48   ` Florian Fainelli
2023-10-10  7:51 ` [PATCH 06/11] pwm: imx-tpm: " Uwe Kleine-König
2023-10-11 11:22   ` Jonathan Cameron
2023-10-10  7:51 ` [PATCH 07/11] pwm: samsung: " Uwe Kleine-König
2023-10-11 11:22   ` Jonathan Cameron
2023-10-10  7:51 ` [PATCH 08/11] pwm: stm32-lp: " Uwe Kleine-König
2023-10-11 11:23   ` Jonathan Cameron
2023-10-10  7:51 ` [PATCH 09/11] pwm: stm32: " Uwe Kleine-König
2023-10-11 11:23   ` Jonathan Cameron

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).