linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/30] pwm: Convert to platform remove callback returning void
@ 2023-03-03 18:54 Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 01/30] pwm: atmel-hlcdc: " Uwe Kleine-König
                   ` (31 more replies)
  0 siblings, 32 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	Ray Jui, Scott Branden, Florian Fainelli, Benson Leung,
	Shawn Guo, Sascha Hauer, Vladimir Zapolskiy, Matthias Brugger,
	Heiko Stuebner, Krzysztof Kozlowski, Palmer Dabbelt,
	Paul Walmsley, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Fabrice Gasnier, Maxime Coquelin, Alexandre Torgue, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Jonathan Hunter, Sean Anderson,
	Michal Simek
  Cc: kernel, linux-pwm, linux-arm-kernel,
	Broadcom internal kernel review list, linux-rpi-kernel,
	Guenter Roeck, chrome-platform, Fabio Estevam, NXP Linux Team,
	AngeloGioacchino Del Regno, linux-mediatek, linux-rockchip,
	Alim Akhtar, linux-samsung-soc, linux-riscv, linux-stm32,
	linux-sunxi, linux-tegra

Hello,

this patch series adapts the platform drivers below drivers/pwm to use
the .remove_new() callback. Compared to the traditional .remove()
callback .remove_new() returns no value. This is a good thing because
the driver core doesn't (and cannot) cope for errors during remove. The
only effect of a non-zero return value in .remove() is that the driver
core emits a warning. The device is removed anyhow and an early return
from .remove() usually yields a resource leak.

By changing the remove callback to return void driver authors cannot
reasonably assume any more that there is some kind of cleanup later.

All drivers touched here returned zero unconditionally in their remove
callback, so they could all be converted trivially to .remove_new().

Note that this series depends on commit 5c5a7680e67b ("platform: Provide
a remove callback that returns no value") that is already in Linus' tree
but not yet included in a tagged version.

Best regards
Uwe

Uwe Kleine-König (30):
  pwm: atmel-hlcdc: Convert to platform remove callback returning void
  pwm: atmel-tcb: Convert to platform remove callback returning void
  pwm: atmel: Convert to platform remove callback returning void
  pwm: bcm-iproc: Convert to platform remove callback returning void
  pwm: bcm2835: Convert to platform remove callback returning void
  pwm: berlin: Convert to platform remove callback returning void
  pwm: brcmstb: Convert to platform remove callback returning void
  pwm: clk: Convert to platform remove callback returning void
  pwm: cros-ec: Convert to platform remove callback returning void
  pwm: hibvt: Convert to platform remove callback returning void
  pwm: img: Convert to platform remove callback returning void
  pwm: imx-tpm: Convert to platform remove callback returning void
  pwm: lpc18xx-sct: Convert to platform remove callback returning void
  pwm: lpss-platform: Convert to platform remove callback returning void
  pwm: mtk-disp: Convert to platform remove callback returning void
  pwm: omap-dmtimer: Convert to platform remove callback returning void
  pwm: rcar: Convert to platform remove callback returning void
  pwm: rockchip: Convert to platform remove callback returning void
  pwm: samsung: Convert to platform remove callback returning void
  pwm: sifive: Convert to platform remove callback returning void
  pwm: spear: Convert to platform remove callback returning void
  pwm: sprd: Convert to platform remove callback returning void
  pwm: sti: Convert to platform remove callback returning void
  pwm: stm32: Convert to platform remove callback returning void
  pwm: sun4i: Convert to platform remove callback returning void
  pwm: tegra: Convert to platform remove callback returning void
  pwm: tiecap: Convert to platform remove callback returning void
  pwm: tiehrpwm: Convert to platform remove callback returning void
  pwm: vt8500: Convert to platform remove callback returning void
  pwm: xilinx: Convert to platform remove callback returning void

 drivers/pwm/pwm-atmel-hlcdc.c   | 6 ++----
 drivers/pwm/pwm-atmel-tcb.c     | 6 ++----
 drivers/pwm/pwm-atmel.c         | 6 ++----
 drivers/pwm/pwm-bcm-iproc.c     | 6 ++----
 drivers/pwm/pwm-bcm2835.c       | 6 ++----
 drivers/pwm/pwm-berlin.c        | 6 ++----
 drivers/pwm/pwm-brcmstb.c       | 6 ++----
 drivers/pwm/pwm-clk.c           | 6 ++----
 drivers/pwm/pwm-cros-ec.c       | 6 ++----
 drivers/pwm/pwm-hibvt.c         | 6 ++----
 drivers/pwm/pwm-img.c           | 6 ++----
 drivers/pwm/pwm-imx-tpm.c       | 6 ++----
 drivers/pwm/pwm-lpc18xx-sct.c   | 6 ++----
 drivers/pwm/pwm-lpss-platform.c | 5 ++---
 drivers/pwm/pwm-mtk-disp.c      | 6 ++----
 drivers/pwm/pwm-omap-dmtimer.c  | 6 ++----
 drivers/pwm/pwm-rcar.c          | 6 ++----
 drivers/pwm/pwm-rockchip.c      | 6 ++----
 drivers/pwm/pwm-samsung.c       | 6 ++----
 drivers/pwm/pwm-sifive.c        | 6 ++----
 drivers/pwm/pwm-spear.c         | 6 ++----
 drivers/pwm/pwm-sprd.c          | 6 ++----
 drivers/pwm/pwm-sti.c           | 6 ++----
 drivers/pwm/pwm-stm32.c         | 6 ++----
 drivers/pwm/pwm-sun4i.c         | 6 ++----
 drivers/pwm/pwm-tegra.c         | 6 ++----
 drivers/pwm/pwm-tiecap.c        | 6 ++----
 drivers/pwm/pwm-tiehrpwm.c      | 6 ++----
 drivers/pwm/pwm-vt8500.c        | 6 ++----
 drivers/pwm/pwm-xilinx.c        | 5 ++---
 30 files changed, 60 insertions(+), 118 deletions(-)

base-commit: 2eb29d59ddf02e39774abfb60b2030b0b7e27c1f
-- 
2.39.1


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

* [PATCH 01/30] pwm: atmel-hlcdc: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-06 11:53   ` Claudiu.Beznea
  2023-03-03 18:54 ` [PATCH 02/30] pwm: atmel-tcb: " Uwe Kleine-König
                   ` (30 subsequent siblings)
  31 siblings, 1 reply; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea
  Cc: kernel, linux-pwm, linux-arm-kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c
index a43b2babc809..96a709a9d49a 100644
--- a/drivers/pwm/pwm-atmel-hlcdc.c
+++ b/drivers/pwm/pwm-atmel-hlcdc.c
@@ -278,15 +278,13 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int atmel_hlcdc_pwm_remove(struct platform_device *pdev)
+static void atmel_hlcdc_pwm_remove(struct platform_device *pdev)
 {
 	struct atmel_hlcdc_pwm *chip = platform_get_drvdata(pdev);
 
 	pwmchip_remove(&chip->chip);
 
 	clk_disable_unprepare(chip->hlcdc->periph_clk);
-
-	return 0;
 }
 
 static const struct of_device_id atmel_hlcdc_pwm_dt_ids[] = {
@@ -301,7 +299,7 @@ static struct platform_driver atmel_hlcdc_pwm_driver = {
 		.pm = &atmel_hlcdc_pwm_pm_ops,
 	},
 	.probe = atmel_hlcdc_pwm_probe,
-	.remove = atmel_hlcdc_pwm_remove,
+	.remove_new = atmel_hlcdc_pwm_remove,
 };
 module_platform_driver(atmel_hlcdc_pwm_driver);
 
-- 
2.39.1


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

* [PATCH 02/30] pwm: atmel-tcb: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 01/30] pwm: atmel-hlcdc: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-06 11:53   ` Claudiu.Beznea
  2023-03-03 18:54 ` [PATCH 03/30] pwm: atmel: " Uwe Kleine-König
                   ` (29 subsequent siblings)
  31 siblings, 1 reply; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea
  Cc: kernel, linux-pwm, linux-arm-kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
index 2837b4ce8053..4a116dc44f6e 100644
--- a/drivers/pwm/pwm-atmel-tcb.c
+++ b/drivers/pwm/pwm-atmel-tcb.c
@@ -500,7 +500,7 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int atmel_tcb_pwm_remove(struct platform_device *pdev)
+static void atmel_tcb_pwm_remove(struct platform_device *pdev)
 {
 	struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev);
 
@@ -509,8 +509,6 @@ static int atmel_tcb_pwm_remove(struct platform_device *pdev)
 	clk_disable_unprepare(tcbpwm->slow_clk);
 	clk_put(tcbpwm->slow_clk);
 	clk_put(tcbpwm->clk);
-
-	return 0;
 }
 
 static const struct of_device_id atmel_tcb_pwm_dt_ids[] = {
@@ -564,7 +562,7 @@ static struct platform_driver atmel_tcb_pwm_driver = {
 		.pm = &atmel_tcb_pwm_pm_ops,
 	},
 	.probe = atmel_tcb_pwm_probe,
-	.remove = atmel_tcb_pwm_remove,
+	.remove_new = atmel_tcb_pwm_remove,
 };
 module_platform_driver(atmel_tcb_pwm_driver);
 
-- 
2.39.1


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

* [PATCH 03/30] pwm: atmel: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 01/30] pwm: atmel-hlcdc: " Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 02/30] pwm: atmel-tcb: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-06 11:53   ` Claudiu.Beznea
  2023-03-03 18:54 ` [PATCH 04/30] pwm: bcm-iproc: " Uwe Kleine-König
                   ` (28 subsequent siblings)
  31 siblings, 1 reply; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Claudiu Beznea, Nicolas Ferre, Alexandre Belloni
  Cc: kernel, linux-arm-kernel, linux-pwm

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
index cdbc23649032..0c567d9623cd 100644
--- a/drivers/pwm/pwm-atmel.c
+++ b/drivers/pwm/pwm-atmel.c
@@ -511,15 +511,13 @@ static int atmel_pwm_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int atmel_pwm_remove(struct platform_device *pdev)
+static void atmel_pwm_remove(struct platform_device *pdev)
 {
 	struct atmel_pwm_chip *atmel_pwm = platform_get_drvdata(pdev);
 
 	pwmchip_remove(&atmel_pwm->chip);
 
 	clk_unprepare(atmel_pwm->clk);
-
-	return 0;
 }
 
 static struct platform_driver atmel_pwm_driver = {
@@ -528,7 +526,7 @@ static struct platform_driver atmel_pwm_driver = {
 		.of_match_table = of_match_ptr(atmel_pwm_dt_ids),
 	},
 	.probe = atmel_pwm_probe,
-	.remove = atmel_pwm_remove,
+	.remove_new = atmel_pwm_remove,
 };
 module_platform_driver(atmel_pwm_driver);
 
-- 
2.39.1


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

* [PATCH 04/30] pwm: bcm-iproc: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (2 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 03/30] pwm: atmel: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 05/30] pwm: bcm2835: " Uwe Kleine-König
                   ` (27 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Ray Jui, Scott Branden
  Cc: kernel, Broadcom internal kernel review list, linux-pwm,
	linux-arm-kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-bcm-iproc.c b/drivers/pwm/pwm-bcm-iproc.c
index 97ec131eb7c1..7d70b6f186a6 100644
--- a/drivers/pwm/pwm-bcm-iproc.c
+++ b/drivers/pwm/pwm-bcm-iproc.c
@@ -239,15 +239,13 @@ static int iproc_pwmc_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int iproc_pwmc_remove(struct platform_device *pdev)
+static void iproc_pwmc_remove(struct platform_device *pdev)
 {
 	struct iproc_pwmc *ip = platform_get_drvdata(pdev);
 
 	pwmchip_remove(&ip->chip);
 
 	clk_disable_unprepare(ip->clk);
-
-	return 0;
 }
 
 static const struct of_device_id bcm_iproc_pwmc_dt[] = {
@@ -262,7 +260,7 @@ static struct platform_driver iproc_pwmc_driver = {
 		.of_match_table = bcm_iproc_pwmc_dt,
 	},
 	.probe = iproc_pwmc_probe,
-	.remove = iproc_pwmc_remove,
+	.remove_new = iproc_pwmc_remove,
 };
 module_platform_driver(iproc_pwmc_driver);
 
-- 
2.39.1


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

* [PATCH 05/30] pwm: bcm2835: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (3 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 04/30] pwm: bcm-iproc: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 06/30] pwm: berlin: " Uwe Kleine-König
                   ` (26 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Florian Fainelli, Ray Jui, Scott Branden
  Cc: kernel, Broadcom internal kernel review list, linux-pwm,
	linux-rpi-kernel, linux-arm-kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c
index 50b8594be31d..bdfc2a5ec0d6 100644
--- a/drivers/pwm/pwm-bcm2835.c
+++ b/drivers/pwm/pwm-bcm2835.c
@@ -173,15 +173,13 @@ static int bcm2835_pwm_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int bcm2835_pwm_remove(struct platform_device *pdev)
+static void bcm2835_pwm_remove(struct platform_device *pdev)
 {
 	struct bcm2835_pwm *pc = platform_get_drvdata(pdev);
 
 	pwmchip_remove(&pc->chip);
 
 	clk_disable_unprepare(pc->clk);
-
-	return 0;
 }
 
 static const struct of_device_id bcm2835_pwm_of_match[] = {
@@ -196,7 +194,7 @@ static struct platform_driver bcm2835_pwm_driver = {
 		.of_match_table = bcm2835_pwm_of_match,
 	},
 	.probe = bcm2835_pwm_probe,
-	.remove = bcm2835_pwm_remove,
+	.remove_new = bcm2835_pwm_remove,
 };
 module_platform_driver(bcm2835_pwm_driver);
 
-- 
2.39.1


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

* [PATCH 06/30] pwm: berlin: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (4 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 05/30] pwm: bcm2835: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 07/30] pwm: brcmstb: " Uwe Kleine-König
                   ` (25 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding; +Cc: kernel, linux-pwm

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-berlin.c b/drivers/pwm/pwm-berlin.c
index e157273fd2f7..0c5992a046b2 100644
--- a/drivers/pwm/pwm-berlin.c
+++ b/drivers/pwm/pwm-berlin.c
@@ -250,15 +250,13 @@ static int berlin_pwm_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int berlin_pwm_remove(struct platform_device *pdev)
+static void berlin_pwm_remove(struct platform_device *pdev)
 {
 	struct berlin_pwm_chip *bpc = platform_get_drvdata(pdev);
 
 	pwmchip_remove(&bpc->chip);
 
 	clk_disable_unprepare(bpc->clk);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -317,7 +315,7 @@ static SIMPLE_DEV_PM_OPS(berlin_pwm_pm_ops, berlin_pwm_suspend,
 
 static struct platform_driver berlin_pwm_driver = {
 	.probe = berlin_pwm_probe,
-	.remove = berlin_pwm_remove,
+	.remove_new = berlin_pwm_remove,
 	.driver = {
 		.name = "berlin-pwm",
 		.of_match_table = berlin_pwm_match,
-- 
2.39.1


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

* [PATCH 07/30] pwm: brcmstb: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (5 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 06/30] pwm: berlin: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 08/30] pwm: clk: " Uwe Kleine-König
                   ` (24 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Florian Fainelli
  Cc: kernel, Broadcom internal kernel review list, linux-pwm,
	linux-arm-kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-brcmstb.c b/drivers/pwm/pwm-brcmstb.c
index 3db3f96edf78..a3faa9a3de7c 100644
--- a/drivers/pwm/pwm-brcmstb.c
+++ b/drivers/pwm/pwm-brcmstb.c
@@ -275,14 +275,12 @@ static int brcmstb_pwm_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int brcmstb_pwm_remove(struct platform_device *pdev)
+static void brcmstb_pwm_remove(struct platform_device *pdev)
 {
 	struct brcmstb_pwm *p = platform_get_drvdata(pdev);
 
 	pwmchip_remove(&p->chip);
 	clk_disable_unprepare(p->clk);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -310,7 +308,7 @@ static SIMPLE_DEV_PM_OPS(brcmstb_pwm_pm_ops, brcmstb_pwm_suspend,
 
 static struct platform_driver brcmstb_pwm_driver = {
 	.probe = brcmstb_pwm_probe,
-	.remove = brcmstb_pwm_remove,
+	.remove_new = brcmstb_pwm_remove,
 	.driver = {
 		.name = "pwm-brcmstb",
 		.of_match_table = brcmstb_pwm_of_match,
-- 
2.39.1


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

* [PATCH 08/30] pwm: clk: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (6 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 07/30] pwm: brcmstb: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 09/30] pwm: cros-ec: " Uwe Kleine-König
                   ` (23 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding; +Cc: kernel, linux-pwm

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-clk.c b/drivers/pwm/pwm-clk.c
index c2a503d684a7..f1da99881adf 100644
--- a/drivers/pwm/pwm-clk.c
+++ b/drivers/pwm/pwm-clk.c
@@ -112,7 +112,7 @@ static int pwm_clk_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int pwm_clk_remove(struct platform_device *pdev)
+static void pwm_clk_remove(struct platform_device *pdev)
 {
 	struct pwm_clk_chip *pcchip = platform_get_drvdata(pdev);
 
@@ -122,8 +122,6 @@ static int pwm_clk_remove(struct platform_device *pdev)
 		clk_disable(pcchip->clk);
 
 	clk_unprepare(pcchip->clk);
-
-	return 0;
 }
 
 static const struct of_device_id pwm_clk_dt_ids[] = {
@@ -138,7 +136,7 @@ static struct platform_driver pwm_clk_driver = {
 		.of_match_table = pwm_clk_dt_ids,
 	},
 	.probe = pwm_clk_probe,
-	.remove = pwm_clk_remove,
+	.remove_new = pwm_clk_remove,
 };
 module_platform_driver(pwm_clk_driver);
 
-- 
2.39.1


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

* [PATCH 09/30] pwm: cros-ec: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (7 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 08/30] pwm: clk: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 19:14   ` Guenter Roeck
  2023-03-03 18:54 ` [PATCH 10/30] pwm: hibvt: " Uwe Kleine-König
                   ` (22 subsequent siblings)
  31 siblings, 1 reply; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Benson Leung
  Cc: kernel, Guenter Roeck, linux-pwm, chrome-platform

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-cros-ec.c b/drivers/pwm/pwm-cros-ec.c
index 86df6702cb83..90afce212fb0 100644
--- a/drivers/pwm/pwm-cros-ec.c
+++ b/drivers/pwm/pwm-cros-ec.c
@@ -328,14 +328,12 @@ static int cros_ec_pwm_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int cros_ec_pwm_remove(struct platform_device *dev)
+static void cros_ec_pwm_remove(struct platform_device *dev)
 {
 	struct cros_ec_pwm_device *ec_pwm = platform_get_drvdata(dev);
 	struct pwm_chip *chip = &ec_pwm->chip;
 
 	pwmchip_remove(chip);
-
-	return 0;
 }
 
 #ifdef CONFIG_OF
@@ -349,7 +347,7 @@ MODULE_DEVICE_TABLE(of, cros_ec_pwm_of_match);
 
 static struct platform_driver cros_ec_pwm_driver = {
 	.probe = cros_ec_pwm_probe,
-	.remove = cros_ec_pwm_remove,
+	.remove_new = cros_ec_pwm_remove,
 	.driver = {
 		.name = "cros-ec-pwm",
 		.of_match_table = of_match_ptr(cros_ec_pwm_of_match),
-- 
2.39.1


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

* [PATCH 10/30] pwm: hibvt: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (8 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 09/30] pwm: cros-ec: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 11/30] pwm: img: " Uwe Kleine-König
                   ` (21 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding; +Cc: kernel, linux-pwm

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-hibvt.c b/drivers/pwm/pwm-hibvt.c
index 12c05c155cab..ab4156853b9b 100644
--- a/drivers/pwm/pwm-hibvt.c
+++ b/drivers/pwm/pwm-hibvt.c
@@ -244,7 +244,7 @@ static int hibvt_pwm_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int hibvt_pwm_remove(struct platform_device *pdev)
+static void hibvt_pwm_remove(struct platform_device *pdev)
 {
 	struct hibvt_pwm_chip *pwm_chip;
 
@@ -257,8 +257,6 @@ static int hibvt_pwm_remove(struct platform_device *pdev)
 	reset_control_deassert(pwm_chip->rstc);
 
 	clk_disable_unprepare(pwm_chip->clk);
-
-	return 0;
 }
 
 static const struct of_device_id hibvt_pwm_of_match[] = {
@@ -280,7 +278,7 @@ static struct platform_driver hibvt_pwm_driver = {
 		.of_match_table = hibvt_pwm_of_match,
 	},
 	.probe = hibvt_pwm_probe,
-	.remove	= hibvt_pwm_remove,
+	.remove_new = hibvt_pwm_remove,
 };
 module_platform_driver(hibvt_pwm_driver);
 
-- 
2.39.1


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

* [PATCH 11/30] pwm: img: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (9 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 10/30] pwm: hibvt: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 12/30] pwm: imx-tpm: " Uwe Kleine-König
                   ` (20 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding; +Cc: kernel, linux-pwm

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c
index 89362afe3c91..326af85888e7 100644
--- a/drivers/pwm/pwm-img.c
+++ b/drivers/pwm/pwm-img.c
@@ -343,7 +343,7 @@ static int img_pwm_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int img_pwm_remove(struct platform_device *pdev)
+static void img_pwm_remove(struct platform_device *pdev)
 {
 	struct img_pwm_chip *imgchip = platform_get_drvdata(pdev);
 
@@ -352,8 +352,6 @@ static int img_pwm_remove(struct platform_device *pdev)
 		img_pwm_runtime_suspend(&pdev->dev);
 
 	pwmchip_remove(&imgchip->chip);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -423,7 +421,7 @@ static struct platform_driver img_pwm_driver = {
 		.of_match_table = img_pwm_of_match,
 	},
 	.probe = img_pwm_probe,
-	.remove = img_pwm_remove,
+	.remove_new = img_pwm_remove,
 };
 module_platform_driver(img_pwm_driver);
 
-- 
2.39.1


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

* [PATCH 12/30] pwm: imx-tpm: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (10 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 11/30] pwm: img: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 13/30] pwm: lpc18xx-sct: " Uwe Kleine-König
                   ` (19 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Shawn Guo, Sascha Hauer
  Cc: kernel, Fabio Estevam, NXP Linux Team, linux-pwm, linux-arm-kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-imx-tpm.c b/drivers/pwm/pwm-imx-tpm.c
index ed1aad96fff0..5e2b452ee5f2 100644
--- a/drivers/pwm/pwm-imx-tpm.c
+++ b/drivers/pwm/pwm-imx-tpm.c
@@ -381,15 +381,13 @@ static int pwm_imx_tpm_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int pwm_imx_tpm_remove(struct platform_device *pdev)
+static void pwm_imx_tpm_remove(struct platform_device *pdev)
 {
 	struct imx_tpm_pwm_chip *tpm = platform_get_drvdata(pdev);
 
 	pwmchip_remove(&tpm->chip);
 
 	clk_disable_unprepare(tpm->clk);
-
-	return 0;
 }
 
 static int __maybe_unused pwm_imx_tpm_suspend(struct device *dev)
@@ -432,7 +430,7 @@ static struct platform_driver imx_tpm_pwm_driver = {
 		.pm = &imx_tpm_pwm_pm,
 	},
 	.probe	= pwm_imx_tpm_probe,
-	.remove = pwm_imx_tpm_remove,
+	.remove_new = pwm_imx_tpm_remove,
 };
 module_platform_driver(imx_tpm_pwm_driver);
 
-- 
2.39.1


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

* [PATCH 13/30] pwm: lpc18xx-sct: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (11 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 12/30] pwm: imx-tpm: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 14/30] pwm: lpss-platform: " Uwe Kleine-König
                   ` (18 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Vladimir Zapolskiy; +Cc: kernel, linux-pwm, linux-arm-kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c
index 378e1df944dc..b9bf5b366f4b 100644
--- a/drivers/pwm/pwm-lpc18xx-sct.c
+++ b/drivers/pwm/pwm-lpc18xx-sct.c
@@ -449,7 +449,7 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int lpc18xx_pwm_remove(struct platform_device *pdev)
+static void lpc18xx_pwm_remove(struct platform_device *pdev)
 {
 	struct lpc18xx_pwm_chip *lpc18xx_pwm = platform_get_drvdata(pdev);
 	u32 val;
@@ -461,8 +461,6 @@ static int lpc18xx_pwm_remove(struct platform_device *pdev)
 			   val | LPC18XX_PWM_CTRL_HALT);
 
 	clk_disable_unprepare(lpc18xx_pwm->pwm_clk);
-
-	return 0;
 }
 
 static struct platform_driver lpc18xx_pwm_driver = {
@@ -471,7 +469,7 @@ static struct platform_driver lpc18xx_pwm_driver = {
 		.of_match_table = lpc18xx_pwm_of_match,
 	},
 	.probe = lpc18xx_pwm_probe,
-	.remove = lpc18xx_pwm_remove,
+	.remove_new = lpc18xx_pwm_remove,
 };
 module_platform_driver(lpc18xx_pwm_driver);
 
-- 
2.39.1


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

* [PATCH 14/30] pwm: lpss-platform: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (12 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 13/30] pwm: lpc18xx-sct: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 15/30] pwm: mtk-disp: " Uwe Kleine-König
                   ` (17 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding; +Cc: kernel, linux-pwm

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-lpss-platform.c b/drivers/pwm/pwm-lpss-platform.c
index f350607e28bd..319809aac2c4 100644
--- a/drivers/pwm/pwm-lpss-platform.c
+++ b/drivers/pwm/pwm-lpss-platform.c
@@ -62,10 +62,9 @@ static int pwm_lpss_probe_platform(struct platform_device *pdev)
 	return 0;
 }
 
-static int pwm_lpss_remove_platform(struct platform_device *pdev)
+static void pwm_lpss_remove_platform(struct platform_device *pdev)
 {
 	pm_runtime_disable(&pdev->dev);
-	return 0;
 }
 
 static const struct acpi_device_id pwm_lpss_acpi_match[] = {
@@ -83,7 +82,7 @@ static struct platform_driver pwm_lpss_driver_platform = {
 		.acpi_match_table = pwm_lpss_acpi_match,
 	},
 	.probe = pwm_lpss_probe_platform,
-	.remove = pwm_lpss_remove_platform,
+	.remove_new = pwm_lpss_remove_platform,
 };
 module_platform_driver(pwm_lpss_driver_platform);
 
-- 
2.39.1


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

* [PATCH 15/30] pwm: mtk-disp: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (13 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 14/30] pwm: lpss-platform: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 16/30] pwm: omap-dmtimer: " Uwe Kleine-König
                   ` (16 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Matthias Brugger
  Cc: kernel, AngeloGioacchino Del Regno, linux-pwm, linux-arm-kernel,
	linux-mediatek

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c
index 692a06121b28..4cfe88d54652 100644
--- a/drivers/pwm/pwm-mtk-disp.c
+++ b/drivers/pwm/pwm-mtk-disp.c
@@ -260,13 +260,11 @@ static int mtk_disp_pwm_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int mtk_disp_pwm_remove(struct platform_device *pdev)
+static void mtk_disp_pwm_remove(struct platform_device *pdev)
 {
 	struct mtk_disp_pwm *mdp = platform_get_drvdata(pdev);
 
 	pwmchip_remove(&mdp->chip);
-
-	return 0;
 }
 
 static const struct mtk_pwm_data mt2701_pwm_data = {
@@ -314,7 +312,7 @@ static struct platform_driver mtk_disp_pwm_driver = {
 		.of_match_table = mtk_disp_pwm_of_match,
 	},
 	.probe = mtk_disp_pwm_probe,
-	.remove = mtk_disp_pwm_remove,
+	.remove_new = mtk_disp_pwm_remove,
 };
 module_platform_driver(mtk_disp_pwm_driver);
 
-- 
2.39.1


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

* [PATCH 16/30] pwm: omap-dmtimer: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (14 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 15/30] pwm: mtk-disp: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 17/30] pwm: rcar: " Uwe Kleine-König
                   ` (15 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding; +Cc: kernel, linux-pwm

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c
index fa800fcf31d4..4889fbd8a431 100644
--- a/drivers/pwm/pwm-omap-dmtimer.c
+++ b/drivers/pwm/pwm-omap-dmtimer.c
@@ -441,7 +441,7 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int pwm_omap_dmtimer_remove(struct platform_device *pdev)
+static void pwm_omap_dmtimer_remove(struct platform_device *pdev)
 {
 	struct pwm_omap_dmtimer_chip *omap = platform_get_drvdata(pdev);
 
@@ -455,8 +455,6 @@ static int pwm_omap_dmtimer_remove(struct platform_device *pdev)
 	put_device(&omap->dm_timer_pdev->dev);
 
 	mutex_destroy(&omap->mutex);
-
-	return 0;
 }
 
 static const struct of_device_id pwm_omap_dmtimer_of_match[] = {
@@ -471,7 +469,7 @@ static struct platform_driver pwm_omap_dmtimer_driver = {
 		.of_match_table = of_match_ptr(pwm_omap_dmtimer_of_match),
 	},
 	.probe = pwm_omap_dmtimer_probe,
-	.remove	= pwm_omap_dmtimer_remove,
+	.remove_new = pwm_omap_dmtimer_remove,
 };
 module_platform_driver(pwm_omap_dmtimer_driver);
 
-- 
2.39.1


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

* [PATCH 17/30] pwm: rcar: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (15 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 16/30] pwm: omap-dmtimer: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 18/30] pwm: rockchip: " Uwe Kleine-König
                   ` (14 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding; +Cc: kernel, linux-pwm

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c
index 55f46d09602b..e9d8646dc331 100644
--- a/drivers/pwm/pwm-rcar.c
+++ b/drivers/pwm/pwm-rcar.c
@@ -238,15 +238,13 @@ static int rcar_pwm_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int rcar_pwm_remove(struct platform_device *pdev)
+static void rcar_pwm_remove(struct platform_device *pdev)
 {
 	struct rcar_pwm_chip *rcar_pwm = platform_get_drvdata(pdev);
 
 	pwmchip_remove(&rcar_pwm->chip);
 
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 static const struct of_device_id rcar_pwm_of_table[] = {
@@ -257,7 +255,7 @@ MODULE_DEVICE_TABLE(of, rcar_pwm_of_table);
 
 static struct platform_driver rcar_pwm_driver = {
 	.probe = rcar_pwm_probe,
-	.remove = rcar_pwm_remove,
+	.remove_new = rcar_pwm_remove,
 	.driver = {
 		.name = "pwm-rcar",
 		.of_match_table = of_match_ptr(rcar_pwm_of_table),
-- 
2.39.1


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

* [PATCH 18/30] pwm: rockchip: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (16 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 17/30] pwm: rcar: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 19/30] pwm: samsung: " Uwe Kleine-König
                   ` (13 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Heiko Stuebner
  Cc: kernel, linux-pwm, linux-arm-kernel, linux-rockchip

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c
index 7f084eb34092..c1a1f2d864b5 100644
--- a/drivers/pwm/pwm-rockchip.c
+++ b/drivers/pwm/pwm-rockchip.c
@@ -376,7 +376,7 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int rockchip_pwm_remove(struct platform_device *pdev)
+static void rockchip_pwm_remove(struct platform_device *pdev)
 {
 	struct rockchip_pwm_chip *pc = platform_get_drvdata(pdev);
 
@@ -384,8 +384,6 @@ static int rockchip_pwm_remove(struct platform_device *pdev)
 
 	clk_unprepare(pc->pclk);
 	clk_unprepare(pc->clk);
-
-	return 0;
 }
 
 static struct platform_driver rockchip_pwm_driver = {
@@ -394,7 +392,7 @@ static struct platform_driver rockchip_pwm_driver = {
 		.of_match_table = rockchip_pwm_dt_ids,
 	},
 	.probe = rockchip_pwm_probe,
-	.remove = rockchip_pwm_remove,
+	.remove_new = rockchip_pwm_remove,
 };
 module_platform_driver(rockchip_pwm_driver);
 
-- 
2.39.1


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

* [PATCH 19/30] pwm: samsung: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (17 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 18/30] pwm: rockchip: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 20/30] pwm: sifive: " Uwe Kleine-König
                   ` (12 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Krzysztof Kozlowski
  Cc: kernel, Alim Akhtar, linux-arm-kernel, linux-samsung-soc, linux-pwm

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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 9c5b4f515641..e8828f57ab15 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c
@@ -621,15 +621,13 @@ static int pwm_samsung_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int pwm_samsung_remove(struct platform_device *pdev)
+static void pwm_samsung_remove(struct platform_device *pdev)
 {
 	struct samsung_pwm_chip *chip = platform_get_drvdata(pdev);
 
 	pwmchip_remove(&chip->chip);
 
 	clk_disable_unprepare(chip->base_clk);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -676,7 +674,7 @@ static struct platform_driver pwm_samsung_driver = {
 		.of_match_table = of_match_ptr(samsung_pwm_matches),
 	},
 	.probe		= pwm_samsung_probe,
-	.remove		= pwm_samsung_remove,
+	.remove_new	= pwm_samsung_remove,
 };
 module_platform_driver(pwm_samsung_driver);
 
-- 
2.39.1


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

* [PATCH 20/30] pwm: sifive: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (18 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 19/30] pwm: samsung: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 21/30] pwm: spear: " Uwe Kleine-König
                   ` (11 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Palmer Dabbelt, Paul Walmsley
  Cc: kernel, linux-pwm, linux-riscv

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-sifive.c b/drivers/pwm/pwm-sifive.c
index 393a4b97fc19..5b0574f635f6 100644
--- a/drivers/pwm/pwm-sifive.c
+++ b/drivers/pwm/pwm-sifive.c
@@ -313,7 +313,7 @@ static int pwm_sifive_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int pwm_sifive_remove(struct platform_device *dev)
+static void pwm_sifive_remove(struct platform_device *dev)
 {
 	struct pwm_sifive_ddata *ddata = platform_get_drvdata(dev);
 	struct pwm_device *pwm;
@@ -329,8 +329,6 @@ static int pwm_sifive_remove(struct platform_device *dev)
 	}
 
 	clk_unprepare(ddata->clk);
-
-	return 0;
 }
 
 static const struct of_device_id pwm_sifive_of_match[] = {
@@ -341,7 +339,7 @@ MODULE_DEVICE_TABLE(of, pwm_sifive_of_match);
 
 static struct platform_driver pwm_sifive_driver = {
 	.probe = pwm_sifive_probe,
-	.remove = pwm_sifive_remove,
+	.remove_new = pwm_sifive_remove,
 	.driver = {
 		.name = "pwm-sifive",
 		.of_match_table = pwm_sifive_of_match,
-- 
2.39.1


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

* [PATCH 21/30] pwm: spear: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (19 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 20/30] pwm: sifive: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 22/30] pwm: sprd: " Uwe Kleine-König
                   ` (10 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding; +Cc: kernel, linux-pwm

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c
index 54c7990967dd..4e1cfd8d7c03 100644
--- a/drivers/pwm/pwm-spear.c
+++ b/drivers/pwm/pwm-spear.c
@@ -247,7 +247,7 @@ static int spear_pwm_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int spear_pwm_remove(struct platform_device *pdev)
+static void spear_pwm_remove(struct platform_device *pdev)
 {
 	struct spear_pwm_chip *pc = platform_get_drvdata(pdev);
 
@@ -255,8 +255,6 @@ static int spear_pwm_remove(struct platform_device *pdev)
 
 	/* clk was prepared in probe, hence unprepare it here */
 	clk_unprepare(pc->clk);
-
-	return 0;
 }
 
 static const struct of_device_id spear_pwm_of_match[] = {
@@ -273,7 +271,7 @@ static struct platform_driver spear_pwm_driver = {
 		.of_match_table = spear_pwm_of_match,
 	},
 	.probe = spear_pwm_probe,
-	.remove = spear_pwm_remove,
+	.remove_new = spear_pwm_remove,
 };
 
 module_platform_driver(spear_pwm_driver);
-- 
2.39.1


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

* [PATCH 22/30] pwm: sprd: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (20 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 21/30] pwm: spear: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 23/30] pwm: sti: " Uwe Kleine-König
                   ` (9 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Orson Zhai, Baolin Wang, Chunyan Zhang; +Cc: kernel, linux-pwm

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-sprd.c b/drivers/pwm/pwm-sprd.c
index d866ce345f97..3b69fe6ecdac 100644
--- a/drivers/pwm/pwm-sprd.c
+++ b/drivers/pwm/pwm-sprd.c
@@ -279,13 +279,11 @@ static int sprd_pwm_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int sprd_pwm_remove(struct platform_device *pdev)
+static void sprd_pwm_remove(struct platform_device *pdev)
 {
 	struct sprd_pwm_chip *spc = platform_get_drvdata(pdev);
 
 	pwmchip_remove(&spc->chip);
-
-	return 0;
 }
 
 static const struct of_device_id sprd_pwm_of_match[] = {
@@ -300,7 +298,7 @@ static struct platform_driver sprd_pwm_driver = {
 		.of_match_table = sprd_pwm_of_match,
 	},
 	.probe = sprd_pwm_probe,
-	.remove = sprd_pwm_remove,
+	.remove_new = sprd_pwm_remove,
 };
 
 module_platform_driver(sprd_pwm_driver);
-- 
2.39.1


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

* [PATCH 23/30] pwm: sti: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (21 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 22/30] pwm: sprd: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 24/30] pwm: stm32: " Uwe Kleine-König
                   ` (8 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding; +Cc: kernel, linux-pwm

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-sti.c b/drivers/pwm/pwm-sti.c
index 44b1f93256b3..b1d1373648a3 100644
--- a/drivers/pwm/pwm-sti.c
+++ b/drivers/pwm/pwm-sti.c
@@ -669,7 +669,7 @@ static int sti_pwm_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int sti_pwm_remove(struct platform_device *pdev)
+static void sti_pwm_remove(struct platform_device *pdev)
 {
 	struct sti_pwm_chip *pc = platform_get_drvdata(pdev);
 
@@ -677,8 +677,6 @@ static int sti_pwm_remove(struct platform_device *pdev)
 
 	clk_unprepare(pc->pwm_clk);
 	clk_unprepare(pc->cpt_clk);
-
-	return 0;
 }
 
 static const struct of_device_id sti_pwm_of_match[] = {
@@ -693,7 +691,7 @@ static struct platform_driver sti_pwm_driver = {
 		.of_match_table = sti_pwm_of_match,
 	},
 	.probe = sti_pwm_probe,
-	.remove = sti_pwm_remove,
+	.remove_new = sti_pwm_remove,
 };
 module_platform_driver(sti_pwm_driver);
 
-- 
2.39.1


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

* [PATCH 24/30] pwm: stm32: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (22 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 23/30] pwm: sti: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 25/30] pwm: sun4i: " Uwe Kleine-König
                   ` (7 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Fabrice Gasnier, Maxime Coquelin, Alexandre Torgue
  Cc: kernel, linux-pwm, linux-stm32, linux-arm-kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
index 21e4a34dfff3..a482f7e0e4ab 100644
--- a/drivers/pwm/pwm-stm32.c
+++ b/drivers/pwm/pwm-stm32.c
@@ -642,7 +642,7 @@ static int stm32_pwm_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int stm32_pwm_remove(struct platform_device *pdev)
+static void stm32_pwm_remove(struct platform_device *pdev)
 {
 	struct stm32_pwm *priv = platform_get_drvdata(pdev);
 	unsigned int i;
@@ -651,8 +651,6 @@ static int stm32_pwm_remove(struct platform_device *pdev)
 		pwm_disable(&priv->chip.pwms[i]);
 
 	pwmchip_remove(&priv->chip);
-
-	return 0;
 }
 
 static int __maybe_unused stm32_pwm_suspend(struct device *dev)
@@ -699,7 +697,7 @@ MODULE_DEVICE_TABLE(of, stm32_pwm_of_match);
 
 static struct platform_driver stm32_pwm_driver = {
 	.probe	= stm32_pwm_probe,
-	.remove	= stm32_pwm_remove,
+	.remove_new = stm32_pwm_remove,
 	.driver	= {
 		.name = "stm32-pwm",
 		.of_match_table = stm32_pwm_of_match,
-- 
2.39.1


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

* [PATCH 25/30] pwm: sun4i: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (23 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 24/30] pwm: stm32: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-14 20:13   ` Jernej Škrabec
  2023-03-03 18:54 ` [PATCH 26/30] pwm: tegra: " Uwe Kleine-König
                   ` (6 subsequent siblings)
  31 siblings, 1 reply; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: kernel, linux-pwm, linux-arm-kernel, linux-sunxi

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
index b973da73e9ab..a8790a8fc53e 100644
--- a/drivers/pwm/pwm-sun4i.c
+++ b/drivers/pwm/pwm-sun4i.c
@@ -477,7 +477,7 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int sun4i_pwm_remove(struct platform_device *pdev)
+static void sun4i_pwm_remove(struct platform_device *pdev)
 {
 	struct sun4i_pwm_chip *sun4ichip = platform_get_drvdata(pdev);
 
@@ -485,8 +485,6 @@ static int sun4i_pwm_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(sun4ichip->bus_clk);
 	reset_control_assert(sun4ichip->rst);
-
-	return 0;
 }
 
 static struct platform_driver sun4i_pwm_driver = {
@@ -495,7 +493,7 @@ static struct platform_driver sun4i_pwm_driver = {
 		.of_match_table = sun4i_pwm_dt_ids,
 	},
 	.probe = sun4i_pwm_probe,
-	.remove = sun4i_pwm_remove,
+	.remove_new = sun4i_pwm_remove,
 };
 module_platform_driver(sun4i_pwm_driver);
 
-- 
2.39.1


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

* [PATCH 26/30] pwm: tegra: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (24 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 25/30] pwm: sun4i: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 27/30] pwm: tiecap: " Uwe Kleine-König
                   ` (5 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter; +Cc: kernel, linux-pwm, linux-tegra

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c
index 249dc0193297..5810abf66e2a 100644
--- a/drivers/pwm/pwm-tegra.c
+++ b/drivers/pwm/pwm-tegra.c
@@ -350,7 +350,7 @@ static int tegra_pwm_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int tegra_pwm_remove(struct platform_device *pdev)
+static void tegra_pwm_remove(struct platform_device *pdev)
 {
 	struct tegra_pwm_chip *pc = platform_get_drvdata(pdev);
 
@@ -359,8 +359,6 @@ static int tegra_pwm_remove(struct platform_device *pdev)
 	reset_control_assert(pc->rst);
 
 	pm_runtime_force_suspend(&pdev->dev);
-
-	return 0;
 }
 
 static int __maybe_unused tegra_pwm_runtime_suspend(struct device *dev)
@@ -434,7 +432,7 @@ static struct platform_driver tegra_pwm_driver = {
 		.pm = &tegra_pwm_pm_ops,
 	},
 	.probe = tegra_pwm_probe,
-	.remove = tegra_pwm_remove,
+	.remove_new = tegra_pwm_remove,
 };
 
 module_platform_driver(tegra_pwm_driver);
-- 
2.39.1


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

* [PATCH 27/30] pwm: tiecap: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (25 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 26/30] pwm: tegra: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 28/30] pwm: tiehrpwm: " Uwe Kleine-König
                   ` (4 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding; +Cc: kernel, linux-pwm

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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 4701f0c9b921..109449956307 100644
--- a/drivers/pwm/pwm-tiecap.c
+++ b/drivers/pwm/pwm-tiecap.c
@@ -265,11 +265,9 @@ static int ecap_pwm_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int ecap_pwm_remove(struct platform_device *pdev)
+static void ecap_pwm_remove(struct platform_device *pdev)
 {
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -326,7 +324,7 @@ static struct platform_driver ecap_pwm_driver = {
 		.pm = &ecap_pwm_pm_ops,
 	},
 	.probe = ecap_pwm_probe,
-	.remove = ecap_pwm_remove,
+	.remove_new = ecap_pwm_remove,
 };
 module_platform_driver(ecap_pwm_driver);
 
-- 
2.39.1


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

* [PATCH 28/30] pwm: tiehrpwm: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (26 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 27/30] pwm: tiecap: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 29/30] pwm: vt8500: " Uwe Kleine-König
                   ` (3 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding; +Cc: kernel, linux-pwm

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
index 48ca0ff690ae..bb3959ace6b4 100644
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -511,7 +511,7 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int ehrpwm_pwm_remove(struct platform_device *pdev)
+static void ehrpwm_pwm_remove(struct platform_device *pdev)
 {
 	struct ehrpwm_pwm_chip *pc = platform_get_drvdata(pdev);
 
@@ -520,8 +520,6 @@ static int ehrpwm_pwm_remove(struct platform_device *pdev)
 	clk_unprepare(pc->tbclk);
 
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -604,7 +602,7 @@ static struct platform_driver ehrpwm_pwm_driver = {
 		.pm = &ehrpwm_pwm_pm_ops,
 	},
 	.probe = ehrpwm_pwm_probe,
-	.remove = ehrpwm_pwm_remove,
+	.remove_new = ehrpwm_pwm_remove,
 };
 module_platform_driver(ehrpwm_pwm_driver);
 
-- 
2.39.1


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

* [PATCH 29/30] pwm: vt8500: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (27 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 28/30] pwm: tiehrpwm: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:54 ` [PATCH 30/30] pwm: xilinx: " Uwe Kleine-König
                   ` (2 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding; +Cc: kernel, linux-arm-kernel, linux-pwm

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c
index f1ff9940b37c..d2c48fd98706 100644
--- a/drivers/pwm/pwm-vt8500.c
+++ b/drivers/pwm/pwm-vt8500.c
@@ -279,20 +279,18 @@ static int vt8500_pwm_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int vt8500_pwm_remove(struct platform_device *pdev)
+static void vt8500_pwm_remove(struct platform_device *pdev)
 {
 	struct vt8500_chip *vt8500 = platform_get_drvdata(pdev);
 
 	pwmchip_remove(&vt8500->chip);
 
 	clk_unprepare(vt8500->clk);
-
-	return 0;
 }
 
 static struct platform_driver vt8500_pwm_driver = {
 	.probe		= vt8500_pwm_probe,
-	.remove		= vt8500_pwm_remove,
+	.remove_new	= vt8500_pwm_remove,
 	.driver		= {
 		.name	= "vt8500-pwm",
 		.of_match_table = vt8500_pwm_dt_ids,
-- 
2.39.1


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

* [PATCH 30/30] pwm: xilinx: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (28 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 29/30] pwm: vt8500: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-03-03 18:58   ` Sean Anderson
  2023-05-08  3:45 ` [PATCH 00/30] pwm: " patchwork-bot+chrome-platform
  2023-05-08  3:56 ` patchwork-bot+chrome-platform
  31 siblings, 1 reply; 39+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
  To: Thierry Reding, Sean Anderson, Michal Simek
  Cc: kernel, linux-pwm, linux-arm-kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

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

diff --git a/drivers/pwm/pwm-xilinx.c b/drivers/pwm/pwm-xilinx.c
index f7a50fdcd9a5..85153ee90809 100644
--- a/drivers/pwm/pwm-xilinx.c
+++ b/drivers/pwm/pwm-xilinx.c
@@ -292,14 +292,13 @@ static int xilinx_pwm_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int xilinx_pwm_remove(struct platform_device *pdev)
+static void xilinx_pwm_remove(struct platform_device *pdev)
 {
 	struct xilinx_pwm_device *xilinx_pwm = platform_get_drvdata(pdev);
 
 	pwmchip_remove(&xilinx_pwm->chip);
 	clk_rate_exclusive_put(xilinx_pwm->priv.clk);
 	clk_disable_unprepare(xilinx_pwm->priv.clk);
-	return 0;
 }
 
 static const struct of_device_id xilinx_pwm_of_match[] = {
@@ -310,7 +309,7 @@ MODULE_DEVICE_TABLE(of, xilinx_pwm_of_match);
 
 static struct platform_driver xilinx_pwm_driver = {
 	.probe = xilinx_pwm_probe,
-	.remove = xilinx_pwm_remove,
+	.remove_new = xilinx_pwm_remove,
 	.driver = {
 		.name = "xilinx-pwm",
 		.of_match_table = of_match_ptr(xilinx_pwm_of_match),
-- 
2.39.1


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

* Re: [PATCH 30/30] pwm: xilinx: Convert to platform remove callback returning void
  2023-03-03 18:54 ` [PATCH 30/30] pwm: xilinx: " Uwe Kleine-König
@ 2023-03-03 18:58   ` Sean Anderson
  0 siblings, 0 replies; 39+ messages in thread
From: Sean Anderson @ 2023-03-03 18:58 UTC (permalink / raw)
  To: Uwe Kleine-König, Thierry Reding, Michal Simek
  Cc: kernel, linux-pwm, linux-arm-kernel

On 3/3/23 13:54, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is (mostly) ignored
> and this typically results in resource leaks. To improve here there is a
> quest to make the remove callback return void. In the first step of this
> quest all drivers are converted to .remove_new() which already returns
> void.
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/pwm/pwm-xilinx.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-xilinx.c b/drivers/pwm/pwm-xilinx.c
> index f7a50fdcd9a5..85153ee90809 100644
> --- a/drivers/pwm/pwm-xilinx.c
> +++ b/drivers/pwm/pwm-xilinx.c
> @@ -292,14 +292,13 @@ static int xilinx_pwm_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int xilinx_pwm_remove(struct platform_device *pdev)
> +static void xilinx_pwm_remove(struct platform_device *pdev)
>  {
>  	struct xilinx_pwm_device *xilinx_pwm = platform_get_drvdata(pdev);
>  
>  	pwmchip_remove(&xilinx_pwm->chip);
>  	clk_rate_exclusive_put(xilinx_pwm->priv.clk);
>  	clk_disable_unprepare(xilinx_pwm->priv.clk);
> -	return 0;
>  }
>  
>  static const struct of_device_id xilinx_pwm_of_match[] = {
> @@ -310,7 +309,7 @@ MODULE_DEVICE_TABLE(of, xilinx_pwm_of_match);
>  
>  static struct platform_driver xilinx_pwm_driver = {
>  	.probe = xilinx_pwm_probe,
> -	.remove = xilinx_pwm_remove,
> +	.remove_new = xilinx_pwm_remove,
>  	.driver = {
>  		.name = "xilinx-pwm",
>  		.of_match_table = of_match_ptr(xilinx_pwm_of_match),

Reviewed-by: Sean Anderson <sean.anderson@seco.com>

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

* Re: [PATCH 09/30] pwm: cros-ec: Convert to platform remove callback returning void
  2023-03-03 18:54 ` [PATCH 09/30] pwm: cros-ec: " Uwe Kleine-König
@ 2023-03-03 19:14   ` Guenter Roeck
  0 siblings, 0 replies; 39+ messages in thread
From: Guenter Roeck @ 2023-03-03 19:14 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, Benson Leung, kernel, Guenter Roeck, linux-pwm,
	chrome-platform

On Fri, Mar 3, 2023 at 10:55 AM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is (mostly) ignored
> and this typically results in resource leaks. To improve here there is a
> quest to make the remove callback return void. In the first step of this
> quest all drivers are converted to .remove_new() which already returns
> void.
>
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Guenter Roeck <groeck@chromium.org>

> ---
>  drivers/pwm/pwm-cros-ec.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pwm/pwm-cros-ec.c b/drivers/pwm/pwm-cros-ec.c
> index 86df6702cb83..90afce212fb0 100644
> --- a/drivers/pwm/pwm-cros-ec.c
> +++ b/drivers/pwm/pwm-cros-ec.c
> @@ -328,14 +328,12 @@ static int cros_ec_pwm_probe(struct platform_device *pdev)
>         return ret;
>  }
>
> -static int cros_ec_pwm_remove(struct platform_device *dev)
> +static void cros_ec_pwm_remove(struct platform_device *dev)
>  {
>         struct cros_ec_pwm_device *ec_pwm = platform_get_drvdata(dev);
>         struct pwm_chip *chip = &ec_pwm->chip;
>
>         pwmchip_remove(chip);
> -
> -       return 0;
>  }
>
>  #ifdef CONFIG_OF
> @@ -349,7 +347,7 @@ MODULE_DEVICE_TABLE(of, cros_ec_pwm_of_match);
>
>  static struct platform_driver cros_ec_pwm_driver = {
>         .probe = cros_ec_pwm_probe,
> -       .remove = cros_ec_pwm_remove,
> +       .remove_new = cros_ec_pwm_remove,
>         .driver = {
>                 .name = "cros-ec-pwm",
>                 .of_match_table = of_match_ptr(cros_ec_pwm_of_match),
> --
> 2.39.1
>

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

* Re: [PATCH 01/30] pwm: atmel-hlcdc: Convert to platform remove callback returning void
  2023-03-03 18:54 ` [PATCH 01/30] pwm: atmel-hlcdc: " Uwe Kleine-König
@ 2023-03-06 11:53   ` Claudiu.Beznea
  0 siblings, 0 replies; 39+ messages in thread
From: Claudiu.Beznea @ 2023-03-06 11:53 UTC (permalink / raw)
  To: u.kleine-koenig, thierry.reding, Nicolas.Ferre, alexandre.belloni
  Cc: kernel, linux-pwm, linux-arm-kernel

On 03.03.2023 20:54, Uwe Kleine-König wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is (mostly) ignored
> and this typically results in resource leaks. To improve here there is a
> quest to make the remove callback return void. In the first step of this
> quest all drivers are converted to .remove_new() which already returns
> void.
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>


> ---
>  drivers/pwm/pwm-atmel-hlcdc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c
> index a43b2babc809..96a709a9d49a 100644
> --- a/drivers/pwm/pwm-atmel-hlcdc.c
> +++ b/drivers/pwm/pwm-atmel-hlcdc.c
> @@ -278,15 +278,13 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev)
>         return 0;
>  }
> 
> -static int atmel_hlcdc_pwm_remove(struct platform_device *pdev)
> +static void atmel_hlcdc_pwm_remove(struct platform_device *pdev)
>  {
>         struct atmel_hlcdc_pwm *chip = platform_get_drvdata(pdev);
> 
>         pwmchip_remove(&chip->chip);
> 
>         clk_disable_unprepare(chip->hlcdc->periph_clk);
> -
> -       return 0;
>  }
> 
>  static const struct of_device_id atmel_hlcdc_pwm_dt_ids[] = {
> @@ -301,7 +299,7 @@ static struct platform_driver atmel_hlcdc_pwm_driver = {
>                 .pm = &atmel_hlcdc_pwm_pm_ops,
>         },
>         .probe = atmel_hlcdc_pwm_probe,
> -       .remove = atmel_hlcdc_pwm_remove,
> +       .remove_new = atmel_hlcdc_pwm_remove,
>  };
>  module_platform_driver(atmel_hlcdc_pwm_driver);
> 
> --
> 2.39.1
> 


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

* Re: [PATCH 02/30] pwm: atmel-tcb: Convert to platform remove callback returning void
  2023-03-03 18:54 ` [PATCH 02/30] pwm: atmel-tcb: " Uwe Kleine-König
@ 2023-03-06 11:53   ` Claudiu.Beznea
  0 siblings, 0 replies; 39+ messages in thread
From: Claudiu.Beznea @ 2023-03-06 11:53 UTC (permalink / raw)
  To: u.kleine-koenig, thierry.reding, Nicolas.Ferre, alexandre.belloni
  Cc: kernel, linux-pwm, linux-arm-kernel

On 03.03.2023 20:54, Uwe Kleine-König wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is (mostly) ignored
> and this typically results in resource leaks. To improve here there is a
> quest to make the remove callback return void. In the first step of this
> quest all drivers are converted to .remove_new() which already returns
> void.
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>


> ---
>  drivers/pwm/pwm-atmel-tcb.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
> index 2837b4ce8053..4a116dc44f6e 100644
> --- a/drivers/pwm/pwm-atmel-tcb.c
> +++ b/drivers/pwm/pwm-atmel-tcb.c
> @@ -500,7 +500,7 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
>         return err;
>  }
> 
> -static int atmel_tcb_pwm_remove(struct platform_device *pdev)
> +static void atmel_tcb_pwm_remove(struct platform_device *pdev)
>  {
>         struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev);
> 
> @@ -509,8 +509,6 @@ static int atmel_tcb_pwm_remove(struct platform_device *pdev)
>         clk_disable_unprepare(tcbpwm->slow_clk);
>         clk_put(tcbpwm->slow_clk);
>         clk_put(tcbpwm->clk);
> -
> -       return 0;
>  }
> 
>  static const struct of_device_id atmel_tcb_pwm_dt_ids[] = {
> @@ -564,7 +562,7 @@ static struct platform_driver atmel_tcb_pwm_driver = {
>                 .pm = &atmel_tcb_pwm_pm_ops,
>         },
>         .probe = atmel_tcb_pwm_probe,
> -       .remove = atmel_tcb_pwm_remove,
> +       .remove_new = atmel_tcb_pwm_remove,
>  };
>  module_platform_driver(atmel_tcb_pwm_driver);
> 
> --
> 2.39.1
> 


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

* Re: [PATCH 03/30] pwm: atmel: Convert to platform remove callback returning void
  2023-03-03 18:54 ` [PATCH 03/30] pwm: atmel: " Uwe Kleine-König
@ 2023-03-06 11:53   ` Claudiu.Beznea
  0 siblings, 0 replies; 39+ messages in thread
From: Claudiu.Beznea @ 2023-03-06 11:53 UTC (permalink / raw)
  To: u.kleine-koenig, thierry.reding, Nicolas.Ferre, alexandre.belloni
  Cc: kernel, linux-arm-kernel, linux-pwm

On 03.03.2023 20:54, Uwe Kleine-König wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is (mostly) ignored
> and this typically results in resource leaks. To improve here there is a
> quest to make the remove callback return void. In the first step of this
> quest all drivers are converted to .remove_new() which already returns
> void.
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>


> ---
>  drivers/pwm/pwm-atmel.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
> index cdbc23649032..0c567d9623cd 100644
> --- a/drivers/pwm/pwm-atmel.c
> +++ b/drivers/pwm/pwm-atmel.c
> @@ -511,15 +511,13 @@ static int atmel_pwm_probe(struct platform_device *pdev)
>         return ret;
>  }
> 
> -static int atmel_pwm_remove(struct platform_device *pdev)
> +static void atmel_pwm_remove(struct platform_device *pdev)
>  {
>         struct atmel_pwm_chip *atmel_pwm = platform_get_drvdata(pdev);
> 
>         pwmchip_remove(&atmel_pwm->chip);
> 
>         clk_unprepare(atmel_pwm->clk);
> -
> -       return 0;
>  }
> 
>  static struct platform_driver atmel_pwm_driver = {
> @@ -528,7 +526,7 @@ static struct platform_driver atmel_pwm_driver = {
>                 .of_match_table = of_match_ptr(atmel_pwm_dt_ids),
>         },
>         .probe = atmel_pwm_probe,
> -       .remove = atmel_pwm_remove,
> +       .remove_new = atmel_pwm_remove,
>  };
>  module_platform_driver(atmel_pwm_driver);
> 
> --
> 2.39.1
> 


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

* Re: [PATCH 25/30] pwm: sun4i: Convert to platform remove callback returning void
  2023-03-03 18:54 ` [PATCH 25/30] pwm: sun4i: " Uwe Kleine-König
@ 2023-03-14 20:13   ` Jernej Škrabec
  0 siblings, 0 replies; 39+ messages in thread
From: Jernej Škrabec @ 2023-03-14 20:13 UTC (permalink / raw)
  To: Thierry Reding, Chen-Yu Tsai, Samuel Holland, Uwe Kleine-König
  Cc: kernel, linux-pwm, linux-arm-kernel, linux-sunxi

Dne petek, 03. marec 2023 ob 19:54:40 CET je Uwe Kleine-König napisal(a):
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is (mostly) ignored
> and this typically results in resource leaks. To improve here there is a
> quest to make the remove callback return void. In the first step of this
> quest all drivers are converted to .remove_new() which already returns
> void.
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---

Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej

>  drivers/pwm/pwm-sun4i.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
> index b973da73e9ab..a8790a8fc53e 100644
> --- a/drivers/pwm/pwm-sun4i.c
> +++ b/drivers/pwm/pwm-sun4i.c
> @@ -477,7 +477,7 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
> return ret;
>  }
> 
> -static int sun4i_pwm_remove(struct platform_device *pdev)
> +static void sun4i_pwm_remove(struct platform_device *pdev)
>  {
>  	struct sun4i_pwm_chip *sun4ichip = platform_get_drvdata(pdev);
> 
> @@ -485,8 +485,6 @@ static int sun4i_pwm_remove(struct platform_device
> *pdev)
> 
>  	clk_disable_unprepare(sun4ichip->bus_clk);
>  	reset_control_assert(sun4ichip->rst);
> -
> -	return 0;
>  }
> 
>  static struct platform_driver sun4i_pwm_driver = {
> @@ -495,7 +493,7 @@ static struct platform_driver sun4i_pwm_driver = {
>  		.of_match_table = sun4i_pwm_dt_ids,
>  	},
>  	.probe = sun4i_pwm_probe,
> -	.remove = sun4i_pwm_remove,
> +	.remove_new = sun4i_pwm_remove,
>  };
>  module_platform_driver(sun4i_pwm_driver);





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

* Re: [PATCH 00/30] pwm: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (29 preceding siblings ...)
  2023-03-03 18:54 ` [PATCH 30/30] pwm: xilinx: " Uwe Kleine-König
@ 2023-05-08  3:45 ` patchwork-bot+chrome-platform
  2023-05-08  3:56 ` patchwork-bot+chrome-platform
  31 siblings, 0 replies; 39+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-05-08  3:45 UTC (permalink / raw)
  To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?=
  Cc: thierry.reding, nicolas.ferre, alexandre.belloni, claudiu.beznea,
	rjui, sbranden, f.fainelli, bleung, shawnguo, s.hauer, vz,
	matthias.bgg, heiko, krzysztof.kozlowski, palmer, paul.walmsley,
	orsonzhai, baolin.wang, zhang.lyra, fabrice.gasnier,
	mcoquelin.stm32, alexandre.torgue, wens, jernej.skrabec, samuel,
	jonathanh, sean.anderson, michal.simek, kernel, linux-pwm,
	linux-arm-kernel, bcm-kernel-feedback-list, linux-rpi-kernel,
	groeck, chrome-platform, festevam, linux-imx,
	angelogioacchino.delregno, linux-mediatek, linux-rockchip,
	alim.akhtar, linux-samsung-soc, linux-riscv, linux-stm32,
	linux-sunxi, linux-tegra

Hello:

This patch was applied to chrome-platform/linux.git (for-kernelci)
by Thierry Reding <thierry.reding@gmail.com>:

On Fri,  3 Mar 2023 19:54:15 +0100 you wrote:
> Hello,
> 
> this patch series adapts the platform drivers below drivers/pwm to use
> the .remove_new() callback. Compared to the traditional .remove()
> callback .remove_new() returns no value. This is a good thing because
> the driver core doesn't (and cannot) cope for errors during remove. The
> only effect of a non-zero return value in .remove() is that the driver
> core emits a warning. The device is removed anyhow and an early return
> from .remove() usually yields a resource leak.
> 
> [...]

Here is the summary with links:
  - [09/30] pwm: cros-ec: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/159a61a7b5b0

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH 00/30] pwm: Convert to platform remove callback returning void
  2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (30 preceding siblings ...)
  2023-05-08  3:45 ` [PATCH 00/30] pwm: " patchwork-bot+chrome-platform
@ 2023-05-08  3:56 ` patchwork-bot+chrome-platform
  31 siblings, 0 replies; 39+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-05-08  3:56 UTC (permalink / raw)
  To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?=
  Cc: thierry.reding, nicolas.ferre, alexandre.belloni, claudiu.beznea,
	rjui, sbranden, f.fainelli, bleung, shawnguo, s.hauer, vz,
	matthias.bgg, heiko, krzysztof.kozlowski, palmer, paul.walmsley,
	orsonzhai, baolin.wang, zhang.lyra, fabrice.gasnier,
	mcoquelin.stm32, alexandre.torgue, wens, jernej.skrabec, samuel,
	jonathanh, sean.anderson, michal.simek, kernel, linux-pwm,
	linux-arm-kernel, bcm-kernel-feedback-list, linux-rpi-kernel,
	groeck, chrome-platform, festevam, linux-imx,
	angelogioacchino.delregno, linux-mediatek, linux-rockchip,
	alim.akhtar, linux-samsung-soc, linux-riscv, linux-stm32,
	linux-sunxi, linux-tegra

Hello:

This patch was applied to chrome-platform/linux.git (for-next)
by Thierry Reding <thierry.reding@gmail.com>:

On Fri,  3 Mar 2023 19:54:15 +0100 you wrote:
> Hello,
> 
> this patch series adapts the platform drivers below drivers/pwm to use
> the .remove_new() callback. Compared to the traditional .remove()
> callback .remove_new() returns no value. This is a good thing because
> the driver core doesn't (and cannot) cope for errors during remove. The
> only effect of a non-zero return value in .remove() is that the driver
> core emits a warning. The device is removed anyhow and an early return
> from .remove() usually yields a resource leak.
> 
> [...]

Here is the summary with links:
  - [09/30] pwm: cros-ec: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/159a61a7b5b0

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-05-08  3:56 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 01/30] pwm: atmel-hlcdc: " Uwe Kleine-König
2023-03-06 11:53   ` Claudiu.Beznea
2023-03-03 18:54 ` [PATCH 02/30] pwm: atmel-tcb: " Uwe Kleine-König
2023-03-06 11:53   ` Claudiu.Beznea
2023-03-03 18:54 ` [PATCH 03/30] pwm: atmel: " Uwe Kleine-König
2023-03-06 11:53   ` Claudiu.Beznea
2023-03-03 18:54 ` [PATCH 04/30] pwm: bcm-iproc: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 05/30] pwm: bcm2835: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 06/30] pwm: berlin: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 07/30] pwm: brcmstb: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 08/30] pwm: clk: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 09/30] pwm: cros-ec: " Uwe Kleine-König
2023-03-03 19:14   ` Guenter Roeck
2023-03-03 18:54 ` [PATCH 10/30] pwm: hibvt: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 11/30] pwm: img: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 12/30] pwm: imx-tpm: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 13/30] pwm: lpc18xx-sct: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 14/30] pwm: lpss-platform: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 15/30] pwm: mtk-disp: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 16/30] pwm: omap-dmtimer: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 17/30] pwm: rcar: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 18/30] pwm: rockchip: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 19/30] pwm: samsung: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 20/30] pwm: sifive: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 21/30] pwm: spear: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 22/30] pwm: sprd: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 23/30] pwm: sti: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 24/30] pwm: stm32: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 25/30] pwm: sun4i: " Uwe Kleine-König
2023-03-14 20:13   ` Jernej Škrabec
2023-03-03 18:54 ` [PATCH 26/30] pwm: tegra: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 27/30] pwm: tiecap: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 28/30] pwm: tiehrpwm: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 29/30] pwm: vt8500: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 30/30] pwm: xilinx: " Uwe Kleine-König
2023-03-03 18:58   ` Sean Anderson
2023-05-08  3:45 ` [PATCH 00/30] pwm: " patchwork-bot+chrome-platform
2023-05-08  3:56 ` patchwork-bot+chrome-platform

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