linux-samsung-soc.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 19/30] pwm: samsung: " Uwe Kleine-König
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ 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] 4+ 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
@ 2023-03-03 18:54 ` Uwe Kleine-König
  2023-05-08  3:45 ` [PATCH 00/30] pwm: " patchwork-bot+chrome-platform
  2023-05-08  3:56 ` patchwork-bot+chrome-platform
  2 siblings, 0 replies; 4+ 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] 4+ 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
  2023-03-03 18:54 ` [PATCH 19/30] pwm: samsung: " Uwe Kleine-König
@ 2023-05-08  3:45 ` patchwork-bot+chrome-platform
  2023-05-08  3:56 ` patchwork-bot+chrome-platform
  2 siblings, 0 replies; 4+ 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] 4+ 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
  2023-03-03 18:54 ` [PATCH 19/30] pwm: samsung: " Uwe Kleine-König
  2023-05-08  3:45 ` [PATCH 00/30] pwm: " patchwork-bot+chrome-platform
@ 2023-05-08  3:56 ` patchwork-bot+chrome-platform
  2 siblings, 0 replies; 4+ 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] 4+ messages in thread

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

Thread overview: 4+ 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 19/30] pwm: samsung: " Uwe Kleine-König
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).