Linux-Rockchip Archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/23] gpio: Convert to platform remove callback returning void
@ 2023-09-28  7:06 Uwe Kleine-König
  2023-09-28  7:06 ` [PATCH 16/23] gpio: rockchip: " Uwe Kleine-König
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2023-09-28  7:06 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: Mun Yew Tham, Andy Shevchenko, linux-gpio, linux-kernel,
	Doug Berger, Florian Fainelli,
	Broadcom internal kernel review list, linux-arm-kernel,
	Vladimir Zapolskiy, Grygorii Strashko, Santosh Shilimkar,
	Kevin Hilman, linux-omap, Heiko Stuebner, linux-rockchip,
	Kunihiko Hayashi, Masami Hiramatsu, Ray Jui, Scott Branden,
	Shubhrajyoti Datta, Srinivas Neeli, Michal Simek

Hello,

this series converts all platform drivers below drivers/gpio to use
.remove_new(). The motivation is to get rid of an integer return code
that is (mostly) ignored by the platform driver core and error prone on
the driver side.

See commit 5c5a7680e67b ("platform: Provide a remove callback that
returns no value") for an extended explanation and the eventual goal.

There are no interdependencies between the patches. As there are still
quite a few drivers to convert, I'm happy about every patch that makes
it in. So even if there is a merge conflict with one patch until you
apply or a subject prefix is suboptimal, please apply the remainder of
this series anyhow.

Best regards
Uwe

Uwe Kleine-König (23):
  gpio: altera: Convert to platform remove callback returning void
  gpio: amdpt: Convert to platform remove callback returning void
  gpio: brcmstb: Convert to platform remove callback returning void
  gpio: cadence: Convert to platform remove callback returning void
  gpio: dln2: Convert to platform remove callback returning void
  gpio: ftgpio010: Convert to platform remove callback returning void
  gpio: grgpio: Convert to platform remove callback returning void
  gpio: ljca: Convert to platform remove callback returning void
  gpio: lpc18xx: Convert to platform remove callback returning void
  gpio: mb86s7x: Convert to platform remove callback returning void
  gpio: mm-lantiq: Convert to platform remove callback returning void
  gpio: mpc5200: Convert to platform remove callback returning void
  gpio: mpc8xxx: Convert to platform remove callback returning void
  gpio: omap: Convert to platform remove callback returning void
  gpio: rcar: Convert to platform remove callback returning void
  gpio: rockchip: Convert to platform remove callback returning void
  gpio: tb10x: Convert to platform remove callback returning void
  gpio: ts5500: Convert to platform remove callback returning void
  gpio: uniphier: Convert to platform remove callback returning void
  gpio: xgene-sb: Convert to platform remove callback returning void
  gpio: xgs-iproc: Convert to platform remove callback returning void
  gpio: xilinx: Convert to platform remove callback returning void
  gpio: zynq: Convert to platform remove callback returning void

 drivers/gpio/gpio-altera.c    | 6 ++----
 drivers/gpio/gpio-amdpt.c     | 6 ++----
 drivers/gpio/gpio-brcmstb.c   | 6 ++----
 drivers/gpio/gpio-cadence.c   | 6 ++----
 drivers/gpio/gpio-dln2.c      | 6 ++----
 drivers/gpio/gpio-ftgpio010.c | 6 ++----
 drivers/gpio/gpio-grgpio.c    | 6 ++----
 drivers/gpio/gpio-ljca.c      | 5 ++---
 drivers/gpio/gpio-lpc18xx.c   | 6 ++----
 drivers/gpio/gpio-mb86s7x.c   | 6 ++----
 drivers/gpio/gpio-mm-lantiq.c | 6 ++----
 drivers/gpio/gpio-mpc5200.c   | 8 +++-----
 drivers/gpio/gpio-mpc8xxx.c   | 6 ++----
 drivers/gpio/gpio-omap.c      | 6 ++----
 drivers/gpio/gpio-rcar.c      | 5 ++---
 drivers/gpio/gpio-rockchip.c  | 6 ++----
 drivers/gpio/gpio-tb10x.c     | 6 ++----
 drivers/gpio/gpio-ts5500.c    | 6 ++----
 drivers/gpio/gpio-uniphier.c  | 6 ++----
 drivers/gpio/gpio-xgene-sb.c  | 6 ++----
 drivers/gpio/gpio-xgs-iproc.c | 6 ++----
 drivers/gpio/gpio-xilinx.c    | 6 ++----
 drivers/gpio/gpio-zynq.c      | 5 ++---
 23 files changed, 47 insertions(+), 90 deletions(-)


base-commit: 719136e5c24768ebdf80b9daa53facebbdd377c3
-- 
2.40.1


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* [PATCH 16/23] gpio: rockchip: Convert to platform remove callback returning void
  2023-09-28  7:06 [PATCH 00/23] gpio: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-09-28  7:06 ` Uwe Kleine-König
  2023-10-01 22:45   ` Heiko Stuebner
  2023-09-28 21:54 ` [PATCH 00/23] gpio: " Linus Walleij
  2023-10-02  6:52 ` Bartosz Golaszewski
  2 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2023-09-28  7:06 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: Andy Shevchenko, Heiko Stuebner, linux-gpio, linux-arm-kernel,
	linux-rockchip, linux-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 ignored (apart
from emitting a warning) 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. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

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/gpio/gpio-rockchip.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index b35b9604413f..23040a8cea34 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -778,14 +778,12 @@ static int rockchip_gpio_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int rockchip_gpio_remove(struct platform_device *pdev)
+static void rockchip_gpio_remove(struct platform_device *pdev)
 {
 	struct rockchip_pin_bank *bank = platform_get_drvdata(pdev);
 
 	clk_disable_unprepare(bank->clk);
 	gpiochip_remove(&bank->gpio_chip);
-
-	return 0;
 }
 
 static const struct of_device_id rockchip_gpio_match[] = {
@@ -796,7 +794,7 @@ static const struct of_device_id rockchip_gpio_match[] = {
 
 static struct platform_driver rockchip_gpio_driver = {
 	.probe		= rockchip_gpio_probe,
-	.remove		= rockchip_gpio_remove,
+	.remove_new	= rockchip_gpio_remove,
 	.driver		= {
 		.name	= "rockchip-gpio",
 		.of_match_table = rockchip_gpio_match,
-- 
2.40.1


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* Re: [PATCH 00/23] gpio: Convert to platform remove callback returning void
  2023-09-28  7:06 [PATCH 00/23] gpio: Convert to platform remove callback returning void Uwe Kleine-König
  2023-09-28  7:06 ` [PATCH 16/23] gpio: rockchip: " Uwe Kleine-König
@ 2023-09-28 21:54 ` Linus Walleij
  2023-10-02  6:52 ` Bartosz Golaszewski
  2 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2023-09-28 21:54 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Bartosz Golaszewski, Mun Yew Tham, Andy Shevchenko, linux-gpio,
	linux-kernel, Doug Berger, Florian Fainelli,
	Broadcom internal kernel review list, linux-arm-kernel,
	Vladimir Zapolskiy, Grygorii Strashko, Santosh Shilimkar,
	Kevin Hilman, linux-omap, Heiko Stuebner, linux-rockchip,
	Kunihiko Hayashi, Masami Hiramatsu, Ray Jui, Scott Branden,
	Shubhrajyoti Datta, Srinivas Neeli, Michal Simek

On Thu, Sep 28, 2023 at 9:07 AM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:

> this series converts all platform drivers below drivers/gpio to use
> .remove_new(). The motivation is to get rid of an integer return code
> that is (mostly) ignored by the platform driver core and error prone on
> the driver side.

The whole set looks good to me:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* Re: [PATCH 16/23] gpio: rockchip: Convert to platform remove callback returning void
  2023-09-28  7:06 ` [PATCH 16/23] gpio: rockchip: " Uwe Kleine-König
@ 2023-10-01 22:45   ` Heiko Stuebner
  0 siblings, 0 replies; 5+ messages in thread
From: Heiko Stuebner @ 2023-10-01 22:45 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Uwe Kleine-König
  Cc: Andy Shevchenko, linux-gpio, linux-arm-kernel, linux-rockchip,
	linux-kernel

Am Donnerstag, 28. September 2023, 09:06:59 CEST schrieb Uwe Kleine-König:
> 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 ignored (apart
> from emitting a warning) 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. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> 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: Heiko Stuebner <heiko@sntech.de>



_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* Re: [PATCH 00/23] gpio: Convert to platform remove callback returning void
  2023-09-28  7:06 [PATCH 00/23] gpio: Convert to platform remove callback returning void Uwe Kleine-König
  2023-09-28  7:06 ` [PATCH 16/23] gpio: rockchip: " Uwe Kleine-König
  2023-09-28 21:54 ` [PATCH 00/23] gpio: " Linus Walleij
@ 2023-10-02  6:52 ` Bartosz Golaszewski
  2 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2023-10-02  6:52 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Linus Walleij, Mun Yew Tham, Andy Shevchenko, linux-gpio,
	linux-kernel, Doug Berger, Florian Fainelli,
	Broadcom internal kernel review list, linux-arm-kernel,
	Vladimir Zapolskiy, Grygorii Strashko, Santosh Shilimkar,
	Kevin Hilman, linux-omap, Heiko Stuebner, linux-rockchip,
	Kunihiko Hayashi, Masami Hiramatsu, Ray Jui, Scott Branden,
	Shubhrajyoti Datta, Srinivas Neeli, Michal Simek

On Thu, Sep 28, 2023 at 9:07 AM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> Hello,
>
> this series converts all platform drivers below drivers/gpio to use
> .remove_new(). The motivation is to get rid of an integer return code
> that is (mostly) ignored by the platform driver core and error prone on
> the driver side.
>
> See commit 5c5a7680e67b ("platform: Provide a remove callback that
> returns no value") for an extended explanation and the eventual goal.
>
> There are no interdependencies between the patches. As there are still
> quite a few drivers to convert, I'm happy about every patch that makes
> it in. So even if there is a merge conflict with one patch until you
> apply or a subject prefix is suboptimal, please apply the remainder of
> this series anyhow.
>
> Best regards
> Uwe
>
> Uwe Kleine-König (23):
>   gpio: altera: Convert to platform remove callback returning void
>   gpio: amdpt: Convert to platform remove callback returning void
>   gpio: brcmstb: Convert to platform remove callback returning void
>   gpio: cadence: Convert to platform remove callback returning void
>   gpio: dln2: Convert to platform remove callback returning void
>   gpio: ftgpio010: Convert to platform remove callback returning void
>   gpio: grgpio: Convert to platform remove callback returning void
>   gpio: ljca: Convert to platform remove callback returning void
>   gpio: lpc18xx: Convert to platform remove callback returning void
>   gpio: mb86s7x: Convert to platform remove callback returning void
>   gpio: mm-lantiq: Convert to platform remove callback returning void
>   gpio: mpc5200: Convert to platform remove callback returning void
>   gpio: mpc8xxx: Convert to platform remove callback returning void
>   gpio: omap: Convert to platform remove callback returning void
>   gpio: rcar: Convert to platform remove callback returning void
>   gpio: rockchip: Convert to platform remove callback returning void
>   gpio: tb10x: Convert to platform remove callback returning void
>   gpio: ts5500: Convert to platform remove callback returning void
>   gpio: uniphier: Convert to platform remove callback returning void
>   gpio: xgene-sb: Convert to platform remove callback returning void
>   gpio: xgs-iproc: Convert to platform remove callback returning void
>   gpio: xilinx: Convert to platform remove callback returning void
>   gpio: zynq: Convert to platform remove callback returning void
>
>  drivers/gpio/gpio-altera.c    | 6 ++----
>  drivers/gpio/gpio-amdpt.c     | 6 ++----
>  drivers/gpio/gpio-brcmstb.c   | 6 ++----
>  drivers/gpio/gpio-cadence.c   | 6 ++----
>  drivers/gpio/gpio-dln2.c      | 6 ++----
>  drivers/gpio/gpio-ftgpio010.c | 6 ++----
>  drivers/gpio/gpio-grgpio.c    | 6 ++----
>  drivers/gpio/gpio-ljca.c      | 5 ++---
>  drivers/gpio/gpio-lpc18xx.c   | 6 ++----
>  drivers/gpio/gpio-mb86s7x.c   | 6 ++----
>  drivers/gpio/gpio-mm-lantiq.c | 6 ++----
>  drivers/gpio/gpio-mpc5200.c   | 8 +++-----
>  drivers/gpio/gpio-mpc8xxx.c   | 6 ++----
>  drivers/gpio/gpio-omap.c      | 6 ++----
>  drivers/gpio/gpio-rcar.c      | 5 ++---
>  drivers/gpio/gpio-rockchip.c  | 6 ++----
>  drivers/gpio/gpio-tb10x.c     | 6 ++----
>  drivers/gpio/gpio-ts5500.c    | 6 ++----
>  drivers/gpio/gpio-uniphier.c  | 6 ++----
>  drivers/gpio/gpio-xgene-sb.c  | 6 ++----
>  drivers/gpio/gpio-xgs-iproc.c | 6 ++----
>  drivers/gpio/gpio-xilinx.c    | 6 ++----
>  drivers/gpio/gpio-zynq.c      | 5 ++---
>  23 files changed, 47 insertions(+), 90 deletions(-)
>
>
> base-commit: 719136e5c24768ebdf80b9daa53facebbdd377c3
> --
> 2.40.1
>

Series queued for v6.7, thanks!

Bart

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

end of thread, other threads:[~2023-10-02  6:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-28  7:06 [PATCH 00/23] gpio: Convert to platform remove callback returning void Uwe Kleine-König
2023-09-28  7:06 ` [PATCH 16/23] gpio: rockchip: " Uwe Kleine-König
2023-10-01 22:45   ` Heiko Stuebner
2023-09-28 21:54 ` [PATCH 00/23] gpio: " Linus Walleij
2023-10-02  6:52 ` Bartosz Golaszewski

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 read-only IMAP folder(s) and NNTP newsgroup(s).