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

Hello,

this v3 was necessary because some lines in the commit log of a subset
of these patches were eaten. I think that happend during rebase -i where
git drops lines starting with # during git-commit. git-am isn't affected by
this "feature", so application should work fine. Still checking these
lines make it into the git commit is a good idea I think.

Other than the few additional lines in the commit logs, one Reviewed-by:
is added and the series is otherwise unchanged.

Best regards
Uwe

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     |  8 +++-----
 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, 35 insertions(+), 51 deletions(-)


base-commit: 4bb36d126cb3147d6bbfd00242a5b846dacad595
-- 
2.42.0


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

* [PATCH v3 01/11] pwm: atmel-hlcdc: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-23 17:46 [PATCH v3 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
@ 2023-10-23 17:46 ` Uwe Kleine-König
  2023-10-24  7:42   ` Nicolas Ferre
  2023-10-23 17:46 ` [PATCH v3 02/11] pwm: atmel-tcb: " Uwe Kleine-König
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 18+ messages in thread
From: Uwe Kleine-König @ 2023-10-23 17:46 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, linux-pwm,
	linux-arm-kernel, kernel, Jonathan Cameron

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.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
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 07920e034757..3f2c5031a3ba 100644
--- a/drivers/pwm/pwm-atmel-hlcdc.c
+++ b/drivers/pwm/pwm-atmel-hlcdc.c
@@ -180,7 +180,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);
@@ -210,10 +209,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[] = {
 	{
@@ -297,7 +295,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.42.0


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

* [PATCH v3 02/11] pwm: atmel-tcb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-23 17:46 [PATCH v3 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
  2023-10-23 17:46 ` [PATCH v3 01/11] pwm: atmel-hlcdc: " Uwe Kleine-König
@ 2023-10-23 17:46 ` Uwe Kleine-König
  2023-10-24  7:43   ` Nicolas Ferre
  2023-10-23 17:46 ` [PATCH v3 03/11] pwm: berlin: " Uwe Kleine-König
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 18+ messages in thread
From: Uwe Kleine-König @ 2023-10-23 17:46 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, linux-pwm,
	linux-arm-kernel, kernel, Jonathan Cameron

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.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
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 98b33c016c3c..d42c897cb85e 100644
--- a/drivers/pwm/pwm-atmel-tcb.c
+++ b/drivers/pwm/pwm-atmel-tcb.c
@@ -489,7 +489,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);
@@ -522,16 +521,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.42.0


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

* [PATCH v3 03/11] pwm: berlin: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-23 17:46 [PATCH v3 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
  2023-10-23 17:46 ` [PATCH v3 01/11] pwm: atmel-hlcdc: " Uwe Kleine-König
  2023-10-23 17:46 ` [PATCH v3 02/11] pwm: atmel-tcb: " Uwe Kleine-König
@ 2023-10-23 17:46 ` Uwe Kleine-König
  2023-10-23 17:46 ` [PATCH v3 04/11] pwm: brcmstb: " Uwe Kleine-König
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Uwe Kleine-König @ 2023-10-23 17:46 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-pwm, 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-berlin.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pwm/pwm-berlin.c b/drivers/pwm/pwm-berlin.c
index ba2d79991769..442913232dc0 100644
--- a/drivers/pwm/pwm-berlin.c
+++ b/drivers/pwm/pwm-berlin.c
@@ -226,7 +226,6 @@ static int berlin_pwm_probe(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int berlin_pwm_suspend(struct device *dev)
 {
 	struct berlin_pwm_chip *bpc = dev_get_drvdata(dev);
@@ -267,17 +266,16 @@ static int berlin_pwm_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(berlin_pwm_pm_ops, berlin_pwm_suspend,
-			 berlin_pwm_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(berlin_pwm_pm_ops, berlin_pwm_suspend,
+				berlin_pwm_resume);
 
 static struct platform_driver berlin_pwm_driver = {
 	.probe = berlin_pwm_probe,
 	.driver = {
 		.name = "berlin-pwm",
 		.of_match_table = berlin_pwm_match,
-		.pm = &berlin_pwm_pm_ops,
+		.pm = pm_ptr(&berlin_pwm_pm_ops),
 	},
 };
 module_platform_driver(berlin_pwm_driver);
-- 
2.42.0


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

* [PATCH v3 04/11] pwm: brcmstb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-23 17:46 [PATCH v3 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
                   ` (2 preceding siblings ...)
  2023-10-23 17:46 ` [PATCH v3 03/11] pwm: berlin: " Uwe Kleine-König
@ 2023-10-23 17:46 ` Uwe Kleine-König
  2023-10-23 17:46 ` [PATCH v3 05/11] pwm: dwc: " Uwe Kleine-König
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Uwe Kleine-König @ 2023-10-23 17:46 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Florian Fainelli, Broadcom internal kernel review list, linux-pwm,
	linux-arm-kernel, kernel, Jonathan Cameron

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.

Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-brcmstb.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pwm/pwm-brcmstb.c b/drivers/pwm/pwm-brcmstb.c
index b723c2d4f485..0fdeb0b2dbf3 100644
--- a/drivers/pwm/pwm-brcmstb.c
+++ b/drivers/pwm/pwm-brcmstb.c
@@ -259,7 +259,6 @@ static int brcmstb_pwm_probe(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int brcmstb_pwm_suspend(struct device *dev)
 {
 	struct brcmstb_pwm *p = dev_get_drvdata(dev);
@@ -275,17 +274,16 @@ static int brcmstb_pwm_resume(struct device *dev)
 
 	return clk_prepare_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,
 	.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.42.0


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

* [PATCH v3 05/11] pwm: dwc: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-23 17:46 [PATCH v3 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
                   ` (3 preceding siblings ...)
  2023-10-23 17:46 ` [PATCH v3 04/11] pwm: brcmstb: " Uwe Kleine-König
@ 2023-10-23 17:46 ` Uwe Kleine-König
  2023-10-23 17:46 ` [PATCH v3 06/11] pwm: imx-tpm: " Uwe Kleine-König
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Uwe Kleine-König @ 2023-10-23 17:46 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-pwm, 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-dwc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pwm/pwm-dwc.c b/drivers/pwm/pwm-dwc.c
index bd9cadb497d7..4929354f8cd9 100644
--- a/drivers/pwm/pwm-dwc.c
+++ b/drivers/pwm/pwm-dwc.c
@@ -71,7 +71,6 @@ static void dwc_pwm_remove(struct pci_dev *pci)
 	pm_runtime_get_noresume(&pci->dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int dwc_pwm_suspend(struct device *dev)
 {
 	struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
@@ -106,9 +105,8 @@ static int dwc_pwm_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(dwc_pwm_pm_ops, dwc_pwm_suspend, dwc_pwm_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(dwc_pwm_pm_ops, dwc_pwm_suspend, dwc_pwm_resume);
 
 static const struct pci_device_id dwc_pwm_id_table[] = {
 	{ PCI_VDEVICE(INTEL, 0x4bb7) }, /* Elkhart Lake */
@@ -122,7 +120,7 @@ static struct pci_driver dwc_pwm_driver = {
 	.remove = dwc_pwm_remove,
 	.id_table = dwc_pwm_id_table,
 	.driver = {
-		.pm = &dwc_pwm_pm_ops,
+		.pm = pm_ptr(&dwc_pwm_pm_ops),
 	},
 };
 
-- 
2.42.0


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

* [PATCH v3 06/11] pwm: imx-tpm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-23 17:46 [PATCH v3 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
                   ` (4 preceding siblings ...)
  2023-10-23 17:46 ` [PATCH v3 05/11] pwm: dwc: " Uwe Kleine-König
@ 2023-10-23 17:46 ` Uwe Kleine-König
  2023-10-23 17:46 ` [PATCH v3 07/11] pwm: samsung: " Uwe Kleine-König
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Uwe Kleine-König @ 2023-10-23 17:46 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, linux-pwm, linux-arm-kernel, Jonathan Cameron

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.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
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 dc6aafeb9f7b..9fc290e647e1 100644
--- a/drivers/pwm/pwm-imx-tpm.c
+++ b/drivers/pwm/pwm-imx-tpm.c
@@ -371,7 +371,7 @@ static int pwm_imx_tpm_probe(struct platform_device *pdev)
 	return 0;
 }
 
-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);
 
@@ -390,7 +390,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;
@@ -402,8 +402,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", },
@@ -415,7 +415,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,
 };
-- 
2.42.0


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

* [PATCH v3 07/11] pwm: samsung: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-23 17:46 [PATCH v3 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
                   ` (5 preceding siblings ...)
  2023-10-23 17:46 ` [PATCH v3 06/11] pwm: imx-tpm: " Uwe Kleine-König
@ 2023-10-23 17:46 ` Uwe Kleine-König
  2023-10-24 21:42   ` Andi Shyti
  2023-10-23 17:46 ` [PATCH v3 08/11] pwm: stm32-lp: " Uwe Kleine-König
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 18+ messages in thread
From: Uwe Kleine-König @ 2023-10-23 17:46 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Krzysztof Kozlowski, Alim Akhtar, linux-arm-kernel,
	linux-samsung-soc, linux-pwm, kernel, Jonathan Cameron

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.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
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 568491ed6829..e6a8fa77aac7 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c
@@ -620,7 +620,6 @@ static void pwm_samsung_remove(struct platform_device *pdev)
 	clk_disable_unprepare(our_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);
@@ -653,14 +652,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.42.0


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

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

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.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
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 b67974cc1872..439068f3eca1 100644
--- a/drivers/pwm/pwm-stm32-lp.c
+++ b/drivers/pwm/pwm-stm32-lp.c
@@ -218,7 +218,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;
@@ -233,13 +233,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", },
@@ -252,7 +252,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.42.0


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

* [PATCH v3 09/11] pwm: stm32: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-23 17:46 [PATCH v3 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
                   ` (7 preceding siblings ...)
  2023-10-23 17:46 ` [PATCH v3 08/11] pwm: stm32-lp: " Uwe Kleine-König
@ 2023-10-23 17:46 ` Uwe Kleine-König
  2023-11-14 13:47   ` Fabrice Gasnier
  2023-10-23 17:46 ` [PATCH v3 10/11] pwm: tiecap: " Uwe Kleine-König
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 18+ messages in thread
From: Uwe Kleine-König @ 2023-10-23 17:46 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Fabrice Gasnier, Maxime Coquelin, Alexandre Torgue, linux-pwm,
	linux-stm32, linux-arm-kernel, kernel, Jonathan Cameron

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.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
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 3303a754ea02..8be037757b8b 100644
--- a/drivers/pwm/pwm-stm32.c
+++ b/drivers/pwm/pwm-stm32.c
@@ -645,7 +645,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;
@@ -666,7 +666,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;
@@ -679,7 +679,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",	},
@@ -692,7 +692,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.42.0


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

* [PATCH v3 10/11] pwm: tiecap: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-23 17:46 [PATCH v3 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
                   ` (8 preceding siblings ...)
  2023-10-23 17:46 ` [PATCH v3 09/11] pwm: stm32: " Uwe Kleine-König
@ 2023-10-23 17:46 ` Uwe Kleine-König
  2023-10-23 17:46 ` [PATCH v3 11/11] pwm: tiehrpwm: " Uwe Kleine-König
  2023-11-28 17:00 ` [PATCH v3 00/11] pwm: " Thierry Reding
  11 siblings, 0 replies; 18+ messages in thread
From: Uwe Kleine-König @ 2023-10-23 17:46 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-pwm, 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-tiecap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c
index 11e3549cf103..d974f4414ac9 100644
--- a/drivers/pwm/pwm-tiecap.c
+++ b/drivers/pwm/pwm-tiecap.c
@@ -269,7 +269,6 @@ static void ecap_pwm_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static void ecap_pwm_save_context(struct ecap_pwm_chip *pc)
 {
 	pm_runtime_get_sync(pc->chip.dev);
@@ -312,15 +311,14 @@ static int ecap_pwm_resume(struct device *dev)
 	ecap_pwm_restore_context(pc);
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(ecap_pwm_pm_ops, ecap_pwm_suspend, ecap_pwm_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ecap_pwm_pm_ops, ecap_pwm_suspend, ecap_pwm_resume);
 
 static struct platform_driver ecap_pwm_driver = {
 	.driver = {
 		.name = "ecap",
 		.of_match_table = ecap_of_match,
-		.pm = &ecap_pwm_pm_ops,
+		.pm = pm_ptr(&ecap_pwm_pm_ops),
 	},
 	.probe = ecap_pwm_probe,
 	.remove_new = ecap_pwm_remove,
-- 
2.42.0


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

* [PATCH v3 11/11] pwm: tiehrpwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-23 17:46 [PATCH v3 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
                   ` (9 preceding siblings ...)
  2023-10-23 17:46 ` [PATCH v3 10/11] pwm: tiecap: " Uwe Kleine-König
@ 2023-10-23 17:46 ` Uwe Kleine-König
  2023-11-28 17:00 ` [PATCH v3 00/11] pwm: " Thierry Reding
  11 siblings, 0 replies; 18+ messages in thread
From: Uwe Kleine-König @ 2023-10-23 17:46 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-pwm, 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-tiehrpwm.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
index 66ac2655845f..af231fa74fa9 100644
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -521,7 +521,6 @@ static void ehrpwm_pwm_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static void ehrpwm_pwm_save_context(struct ehrpwm_pwm_chip *pc)
 {
 	pm_runtime_get_sync(pc->chip.dev);
@@ -589,16 +588,15 @@ static int ehrpwm_pwm_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(ehrpwm_pwm_pm_ops, ehrpwm_pwm_suspend,
-			 ehrpwm_pwm_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ehrpwm_pwm_pm_ops, ehrpwm_pwm_suspend,
+				ehrpwm_pwm_resume);
 
 static struct platform_driver ehrpwm_pwm_driver = {
 	.driver = {
 		.name = "ehrpwm",
 		.of_match_table = ehrpwm_of_match,
-		.pm = &ehrpwm_pwm_pm_ops,
+		.pm = pm_ptr(&ehrpwm_pwm_pm_ops),
 	},
 	.probe = ehrpwm_pwm_probe,
 	.remove_new = ehrpwm_pwm_remove,
-- 
2.42.0


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

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

On 23/10/2023 at 19:46, 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.
> 
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.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 07920e034757..3f2c5031a3ba 100644
> --- a/drivers/pwm/pwm-atmel-hlcdc.c
> +++ b/drivers/pwm/pwm-atmel-hlcdc.c
> @@ -180,7 +180,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);
> @@ -210,10 +209,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[] = {
>          {
> @@ -297,7 +295,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.42.0
> 


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

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

On 23/10/2023 at 19:46, 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.

Commit message is fine ;-)

> 
> Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> isn't enabled.
> 
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Thanks Uwe for this cleanup. Best regards,
   Nicolas

> ---
>   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 98b33c016c3c..d42c897cb85e 100644
> --- a/drivers/pwm/pwm-atmel-tcb.c
> +++ b/drivers/pwm/pwm-atmel-tcb.c
> @@ -489,7 +489,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);
> @@ -522,16 +521,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.42.0
> 


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

* Re: [PATCH v3 07/11] pwm: samsung: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-23 17:46 ` [PATCH v3 07/11] pwm: samsung: " Uwe Kleine-König
@ 2023-10-24 21:42   ` Andi Shyti
  0 siblings, 0 replies; 18+ messages in thread
From: Andi Shyti @ 2023-10-24 21:42 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, Krzysztof Kozlowski, Alim Akhtar,
	linux-arm-kernel, linux-samsung-soc, linux-pwm, kernel,
	Jonathan Cameron

Hi Uwe,

On Mon, Oct 23, 2023 at 07:46:24PM +0200, 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.
> 
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Andi Shyti <andi.shyti@kernel.org>

Andi

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

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

On 10/23/23 19:46, 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
> __maybe_unused can be dropped.
> 
> Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> isn't enabled.
> 
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 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(-)

Hi Uwe,

Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>

Thanks for the cleanups.
Fabrice

> 
> diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c
> index b67974cc1872..439068f3eca1 100644
> --- a/drivers/pwm/pwm-stm32-lp.c
> +++ b/drivers/pwm/pwm-stm32-lp.c
> @@ -218,7 +218,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;
> @@ -233,13 +233,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", },
> @@ -252,7 +252,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);

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

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

On 10/23/23 19:46, 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
> __maybe_unused can be dropped.
> 
> Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
> isn't enabled.
> 
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 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(-)

Hi Uwe,

Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>

Thanks for the cleanups.
Fabrice
> 
> diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
> index 3303a754ea02..8be037757b8b 100644
> --- a/drivers/pwm/pwm-stm32.c
> +++ b/drivers/pwm/pwm-stm32.c
> @@ -645,7 +645,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;
> @@ -666,7 +666,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;
> @@ -679,7 +679,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",	},
> @@ -692,7 +692,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);

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

* Re: [PATCH v3 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
  2023-10-23 17:46 [PATCH v3 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
                   ` (10 preceding siblings ...)
  2023-10-23 17:46 ` [PATCH v3 11/11] pwm: tiehrpwm: " Uwe Kleine-König
@ 2023-11-28 17:00 ` Thierry Reding
  11 siblings, 0 replies; 18+ messages in thread
From: Thierry Reding @ 2023-11-28 17:00 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, linux-pwm,
	linux-arm-kernel, kernel, Florian Fainelli,
	Broadcom internal kernel review list, Shawn Guo, Sascha Hauer,
	Fabio Estevam, NXP Linux Team, Krzysztof Kozlowski, Alim Akhtar,
	linux-samsung-soc, Fabrice Gasnier, Maxime Coquelin,
	Alexandre Torgue, linux-stm32


On Mon, 23 Oct 2023 19:46:17 +0200, Uwe Kleine-König wrote:
> this v3 was necessary because some lines in the commit log of a subset
> of these patches were eaten. I think that happend during rebase -i where
> git drops lines starting with # during git-commit. git-am isn't affected by
> this "feature", so application should work fine. Still checking these
> lines make it into the git commit is a good idea I think.
> 
> Other than the few additional lines in the commit logs, one Reviewed-by:
> is added and the series is otherwise unchanged.
> 
> [...]

Applied, thanks!

[01/11] pwm: atmel-hlcdc: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
        commit: 68bb27818889b085d3d700be69c483c0ea98f433
[02/11] pwm: atmel-tcb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
        commit: 440e46389dda0aafdfade7fabfa5038f9544ada2
[03/11] pwm: berlin: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
        commit: c462d3f8fd2fc80aa7430fa7a498cbc92f65c3b5
[04/11] pwm: brcmstb: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
        commit: 96f68f6f4932d6ade6878f13c1f644f6b469cf6c
[05/11] pwm: dwc: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
        commit: 9109a4a23509b1664e6479aaa7fd5e983f8387e1
[06/11] pwm: imx-tpm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
        commit: a5b73204fd2e6a78a29cc4baea071ef715731ddc
[07/11] pwm: samsung: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
        commit: 1b12fa3894ea89fefe057f128a5fddc71e3e693c
[08/11] pwm: stm32-lp: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
        commit: a692911fca53e41fdf5c8bc5d66f00e96511762b
[09/11] pwm: stm32: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
        commit: 7c885017ea5b0e8008b18ee175f2c4d0664a4ca1
[10/11] pwm: tiecap: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
        commit: 3ecab1549fe44b25f58fb32eeaea152062513894
[11/11] pwm: tiehrpwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
        commit: b372157f23ea8aa99a240c47a7ba1268656554d5

Best regards,
-- 
Thierry Reding <thierry.reding@gmail.com>

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

end of thread, other threads:[~2023-11-28 17:01 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-23 17:46 [PATCH v3 00/11] pwm: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Uwe Kleine-König
2023-10-23 17:46 ` [PATCH v3 01/11] pwm: atmel-hlcdc: " Uwe Kleine-König
2023-10-24  7:42   ` Nicolas Ferre
2023-10-23 17:46 ` [PATCH v3 02/11] pwm: atmel-tcb: " Uwe Kleine-König
2023-10-24  7:43   ` Nicolas Ferre
2023-10-23 17:46 ` [PATCH v3 03/11] pwm: berlin: " Uwe Kleine-König
2023-10-23 17:46 ` [PATCH v3 04/11] pwm: brcmstb: " Uwe Kleine-König
2023-10-23 17:46 ` [PATCH v3 05/11] pwm: dwc: " Uwe Kleine-König
2023-10-23 17:46 ` [PATCH v3 06/11] pwm: imx-tpm: " Uwe Kleine-König
2023-10-23 17:46 ` [PATCH v3 07/11] pwm: samsung: " Uwe Kleine-König
2023-10-24 21:42   ` Andi Shyti
2023-10-23 17:46 ` [PATCH v3 08/11] pwm: stm32-lp: " Uwe Kleine-König
2023-11-14 13:47   ` Fabrice Gasnier
2023-10-23 17:46 ` [PATCH v3 09/11] pwm: stm32: " Uwe Kleine-König
2023-11-14 13:47   ` Fabrice Gasnier
2023-10-23 17:46 ` [PATCH v3 10/11] pwm: tiecap: " Uwe Kleine-König
2023-10-23 17:46 ` [PATCH v3 11/11] pwm: tiehrpwm: " Uwe Kleine-König
2023-11-28 17:00 ` [PATCH v3 00/11] pwm: " Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox