Linux-Rockchip Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/20] pinctrl: Convert to platform remove callback returning void
@ 2023-10-09  8:38 Uwe Kleine-König
  2023-10-09  8:38 ` [PATCH 11/20] pinctrl: rockchip: " Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2023-10-09  8:38 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Tony Lindgren, Haojian Zhuang, linux-arm-kernel, linux-omap,
	linux-gpio, linux-kernel, Yangtao Li, Andy Shevchenko,
	Maxime Coquelin, Alexandre Torgue, linux-stm32, Charles Keepax,
	Richard Fitzgerald, alsa-devel, patches, Mika Westerberg,
	Andy Shevchenko, Basavaraj Natikar, Shyam Sundar S K,
	Jesper Nilsson, Lars Persson, linux-arm-kernel, Heiko Stuebner,
	linux-rockchip, Andy Gross, Bjorn Andersson, Konrad Dybcio,
	linux-arm-msm, Geert Uytterhoeven, linux-renesas-soc

Hello,

after three minor improvements/simplifications this series converts all
platform_drivers below drivers/pinctrl to .remove_new().

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

The only interdependencies in this series are the patches that touch a
single driver (that is (1, 13), (2, 12), (3, 20)). 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 different concern that doesn't apply to all patches), please
apply the remainder of this series anyhow. I'll come back to the part
that you (maybe) skipped at a later point.

Best regards
Uwe

Uwe Kleine-König (20):
  pinctrl: stmfx: Improve error message in .remove()'s error path
  pinctrl: single: Drop if block with always false condition
  pinctrl: ti: ti-iodelay: Drop if block with always false condition
  pinctrl: cirrus: madera-core: Convert to platform remove callback
    returning void
  pinctrl: intel: cherryview: Convert to platform remove callback
    returning void
  pinctrl: intel: lynxpoint: Convert to platform remove callback
    returning void
  pinctrl: nomadik: abx500: Convert to platform remove callback
    returning void
  pinctrl: amd: Convert to platform remove callback returning void
  pinctrl: artpec6: Convert to platform remove callback returning void
  pinctrl: as3722: Convert to platform remove callback returning void
  pinctrl: rockchip: Convert to platform remove callback returning void
  pinctrl: single: Convert to platform remove callback returning void
  pinctrl: stmfx: Convert to platform remove callback returning void
  pinctrl: tb10x: Convert to platform remove callback returning void
  pinctrl: qcom: spmi-gpio: Convert to platform remove callback
    returning void
  pinctrl: qcom: spmi-mpp: Convert to platform remove callback returning
    void
  pinctrl: qcom: ssbi-gpio: Convert to platform remove callback
    returning void
  pinctrl: qcom: ssbi-mpp: Convert to platform remove callback returning
    void
  pinctrl: renesas: rzn1: Convert to platform remove callback returning
    void
  pinctrl: ti: ti-iodelay: Convert to platform remove callback returning
    void

 drivers/pinctrl/cirrus/pinctrl-madera-core.c |  6 ++----
 drivers/pinctrl/intel/pinctrl-cherryview.c   |  6 ++----
 drivers/pinctrl/intel/pinctrl-lynxpoint.c    |  5 ++---
 drivers/pinctrl/nomadik/pinctrl-abx500.c     |  5 ++---
 drivers/pinctrl/pinctrl-amd.c                |  6 ++----
 drivers/pinctrl/pinctrl-artpec6.c            |  6 ++----
 drivers/pinctrl/pinctrl-as3722.c             |  5 ++---
 drivers/pinctrl/pinctrl-rockchip.c           |  6 ++----
 drivers/pinctrl/pinctrl-single.c             |  9 ++-------
 drivers/pinctrl/pinctrl-stmfx.c              | 16 ++++++++++------
 drivers/pinctrl/pinctrl-tb10x.c              |  6 ++----
 drivers/pinctrl/qcom/pinctrl-spmi-gpio.c     |  5 ++---
 drivers/pinctrl/qcom/pinctrl-spmi-mpp.c      |  5 ++---
 drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c     |  6 ++----
 drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c      |  6 ++----
 drivers/pinctrl/renesas/pinctrl-rzn1.c       |  6 ++----
 drivers/pinctrl/ti/pinctrl-ti-iodelay.c      | 11 ++---------
 17 files changed, 42 insertions(+), 73 deletions(-)


base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
-- 
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] 4+ messages in thread

* [PATCH 11/20] pinctrl: rockchip: Convert to platform remove callback returning void
  2023-10-09  8:38 [PATCH 00/20] pinctrl: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-10-09  8:38 ` Uwe Kleine-König
  2023-10-09 20:16   ` Heiko Stuebner
  2023-10-10 13:40   ` Linus Walleij
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2023-10-09  8:38 UTC (permalink / raw)
  To: Linus Walleij
  Cc: 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/pinctrl/pinctrl-rockchip.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 45e416f68e74..3bedf36a0019 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -3429,7 +3429,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int rockchip_pinctrl_remove(struct platform_device *pdev)
+static void rockchip_pinctrl_remove(struct platform_device *pdev)
 {
 	struct rockchip_pinctrl *info = platform_get_drvdata(pdev);
 	struct rockchip_pin_bank *bank;
@@ -3450,8 +3450,6 @@ static int rockchip_pinctrl_remove(struct platform_device *pdev)
 		}
 		mutex_unlock(&bank->deferred_lock);
 	}
-
-	return 0;
 }
 
 static struct rockchip_pin_bank px30_pin_banks[] = {
@@ -3982,7 +3980,7 @@ static const struct of_device_id rockchip_pinctrl_dt_match[] = {
 
 static struct platform_driver rockchip_pinctrl_driver = {
 	.probe		= rockchip_pinctrl_probe,
-	.remove		= rockchip_pinctrl_remove,
+	.remove_new	= rockchip_pinctrl_remove,
 	.driver = {
 		.name	= "rockchip-pinctrl",
 		.pm = &rockchip_pinctrl_dev_pm_ops,
-- 
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] 4+ messages in thread

* Re: [PATCH 11/20] pinctrl: rockchip: Convert to platform remove callback returning void
  2023-10-09  8:38 ` [PATCH 11/20] pinctrl: rockchip: " Uwe Kleine-König
@ 2023-10-09 20:16   ` Heiko Stuebner
  2023-10-10 13:40   ` Linus Walleij
  1 sibling, 0 replies; 4+ messages in thread
From: Heiko Stuebner @ 2023-10-09 20:16 UTC (permalink / raw)
  To: Linus Walleij, Uwe Kleine-König
  Cc: linux-gpio, linux-arm-kernel, linux-rockchip, linux-kernel

Am Montag, 9. Oktober 2023, 10:38:47 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>

> ---
>  drivers/pinctrl/pinctrl-rockchip.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
> index 45e416f68e74..3bedf36a0019 100644
> --- a/drivers/pinctrl/pinctrl-rockchip.c
> +++ b/drivers/pinctrl/pinctrl-rockchip.c
> @@ -3429,7 +3429,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int rockchip_pinctrl_remove(struct platform_device *pdev)
> +static void rockchip_pinctrl_remove(struct platform_device *pdev)
>  {
>  	struct rockchip_pinctrl *info = platform_get_drvdata(pdev);
>  	struct rockchip_pin_bank *bank;
> @@ -3450,8 +3450,6 @@ static int rockchip_pinctrl_remove(struct platform_device *pdev)
>  		}
>  		mutex_unlock(&bank->deferred_lock);
>  	}
> -
> -	return 0;
>  }
>  
>  static struct rockchip_pin_bank px30_pin_banks[] = {
> @@ -3982,7 +3980,7 @@ static const struct of_device_id rockchip_pinctrl_dt_match[] = {
>  
>  static struct platform_driver rockchip_pinctrl_driver = {
>  	.probe		= rockchip_pinctrl_probe,
> -	.remove		= rockchip_pinctrl_remove,
> +	.remove_new	= rockchip_pinctrl_remove,
>  	.driver = {
>  		.name	= "rockchip-pinctrl",
>  		.pm = &rockchip_pinctrl_dev_pm_ops,
> 





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

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

* Re: [PATCH 11/20] pinctrl: rockchip: Convert to platform remove callback returning void
  2023-10-09  8:38 ` [PATCH 11/20] pinctrl: rockchip: " Uwe Kleine-König
  2023-10-09 20:16   ` Heiko Stuebner
@ 2023-10-10 13:40   ` Linus Walleij
  1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2023-10-10 13:40 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Heiko Stuebner, linux-gpio, linux-arm-kernel, linux-rockchip,
	linux-kernel

On Mon, Oct 9, 2023 at 11:22 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 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>

Patch applied.

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] 4+ messages in thread

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-09  8:38 [PATCH 00/20] pinctrl: Convert to platform remove callback returning void Uwe Kleine-König
2023-10-09  8:38 ` [PATCH 11/20] pinctrl: rockchip: " Uwe Kleine-König
2023-10-09 20:16   ` Heiko Stuebner
2023-10-10 13:40   ` Linus Walleij

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