linux-arm-kernel.lists.infradead.org archive mirror
 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 01/20] pinctrl: stmfx: Improve error message in .remove()'s error path Uwe Kleine-König
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ 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-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 01/20] pinctrl: stmfx: Improve error message in .remove()'s error path
  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-10 13:35   ` Linus Walleij
  2023-10-09  8:38 ` [PATCH 02/20] pinctrl: single: Drop if block with always false condition Uwe Kleine-König
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Uwe Kleine-König @ 2023-10-09  8:38 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Maxime Coquelin, Alexandre Torgue, linux-gpio, linux-stm32,
	linux-arm-kernel, linux-kernel

The driver core has no handling for errors returned by the .remove()
callback. The only action on error is a dev_warn() with generic error
message that the returned value is returned.

Replace it by a more specific and useful message. Then returning zero is
the right thing to do, the only effect is to suppress the core's
warning.

This prepares the driver for the conversion to .remove_new().

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

diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c
index 0974bbf57b54..d7ab82432a52 100644
--- a/drivers/pinctrl/pinctrl-stmfx.c
+++ b/drivers/pinctrl/pinctrl-stmfx.c
@@ -737,11 +737,17 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev)
 static int stmfx_pinctrl_remove(struct platform_device *pdev)
 {
 	struct stmfx *stmfx = dev_get_drvdata(pdev->dev.parent);
+	int ret;
 
-	return stmfx_function_disable(stmfx,
-				      STMFX_FUNC_GPIO |
-				      STMFX_FUNC_ALTGPIO_LOW |
-				      STMFX_FUNC_ALTGPIO_HIGH);
+	ret = stmfx_function_disable(stmfx,
+				     STMFX_FUNC_GPIO |
+				     STMFX_FUNC_ALTGPIO_LOW |
+				     STMFX_FUNC_ALTGPIO_HIGH);
+	if (ret)
+		dev_err(&pdev->dev, "Failed to disable pins (%pe)\n",
+			ERR_PTR(ret));
+
+	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 02/20] pinctrl: single: Drop if block with always false condition
  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 01/20] pinctrl: stmfx: Improve error message in .remove()'s error path Uwe Kleine-König
@ 2023-10-09  8:38 ` Uwe Kleine-König
  2023-10-10 13:36   ` Linus Walleij
  2023-10-09  8:38 ` [PATCH 07/20] pinctrl: nomadik: abx500: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 14+ 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

pcs_remove() is only called after pcs_probe() completed successfully. In
this case platform_set_drvdata() was called with a non-NULL argument and
so platform_get_drvdata() won't return NULL.

Simplify by removing the if block with the always false condition.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pinctrl/pinctrl-single.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 461a7c02d4a3..f6c02c8b934d 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1929,9 +1929,6 @@ static int pcs_remove(struct platform_device *pdev)
 {
 	struct pcs_device *pcs = platform_get_drvdata(pdev);
 
-	if (!pcs)
-		return 0;
-
 	pcs_free_resources(pcs);
 
 	return 0;
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 07/20] pinctrl: nomadik: abx500: 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 ` [PATCH 01/20] pinctrl: stmfx: Improve error message in .remove()'s error path Uwe Kleine-König
  2023-10-09  8:38 ` [PATCH 02/20] pinctrl: single: Drop if block with always false condition Uwe Kleine-König
@ 2023-10-09  8:38 ` Uwe Kleine-König
  2023-10-10 13:38   ` Linus Walleij
  2023-10-09  8:38 ` [PATCH 11/20] pinctrl: rockchip: " Uwe Kleine-König
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Uwe Kleine-König @ 2023-10-09  8:38 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-arm-kernel, linux-gpio, 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/nomadik/pinctrl-abx500.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/nomadik/pinctrl-abx500.c b/drivers/pinctrl/nomadik/pinctrl-abx500.c
index 6b90051af206..233857d54403 100644
--- a/drivers/pinctrl/nomadik/pinctrl-abx500.c
+++ b/drivers/pinctrl/nomadik/pinctrl-abx500.c
@@ -1079,12 +1079,11 @@ static int abx500_gpio_probe(struct platform_device *pdev)
  * abx500_gpio_remove() - remove Ab8500-gpio driver
  * @pdev:	Platform device registered
  */
-static int abx500_gpio_remove(struct platform_device *pdev)
+static void abx500_gpio_remove(struct platform_device *pdev)
 {
 	struct abx500_pinctrl *pct = platform_get_drvdata(pdev);
 
 	gpiochip_remove(&pct->chip);
-	return 0;
 }
 
 static struct platform_driver abx500_gpio_driver = {
@@ -1093,7 +1092,7 @@ static struct platform_driver abx500_gpio_driver = {
 		.of_match_table = abx500_gpio_match,
 	},
 	.probe = abx500_gpio_probe,
-	.remove = abx500_gpio_remove,
+	.remove_new = abx500_gpio_remove,
 };
 
 static int __init abx500_gpio_init(void)
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 14+ 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
                   ` (2 preceding siblings ...)
  2023-10-09  8:38 ` [PATCH 07/20] pinctrl: nomadik: abx500: 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
  2023-10-09  8:38 ` [PATCH 12/20] pinctrl: single: " Uwe Kleine-König
  2023-10-09  8:38 ` [PATCH 13/20] pinctrl: stmfx: " Uwe Kleine-König
  5 siblings, 2 replies; 14+ 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-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 12/20] pinctrl: single: 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
                   ` (3 preceding siblings ...)
  2023-10-09  8:38 ` [PATCH 11/20] pinctrl: rockchip: " Uwe Kleine-König
@ 2023-10-09  8:38 ` Uwe Kleine-König
  2023-10-10 13:41   ` Linus Walleij
  2023-10-09  8:38 ` [PATCH 13/20] pinctrl: stmfx: " Uwe Kleine-König
  5 siblings, 1 reply; 14+ 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

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

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index f6c02c8b934d..1f915269d347 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1925,13 +1925,11 @@ static int pcs_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int pcs_remove(struct platform_device *pdev)
+static void pcs_remove(struct platform_device *pdev)
 {
 	struct pcs_device *pcs = platform_get_drvdata(pdev);
 
 	pcs_free_resources(pcs);
-
-	return 0;
 }
 
 static const struct pcs_soc_data pinctrl_single_omap_wkup = {
@@ -1979,7 +1977,7 @@ MODULE_DEVICE_TABLE(of, pcs_of_match);
 
 static struct platform_driver pcs_driver = {
 	.probe		= pcs_probe,
-	.remove		= pcs_remove,
+	.remove_new	= pcs_remove,
 	.driver = {
 		.name		= DRIVER_NAME,
 		.of_match_table	= pcs_of_match,
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 13/20] pinctrl: stmfx: 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
                   ` (4 preceding siblings ...)
  2023-10-09  8:38 ` [PATCH 12/20] pinctrl: single: " Uwe Kleine-König
@ 2023-10-09  8:38 ` Uwe Kleine-König
  2023-10-10 13:41   ` Linus Walleij
  5 siblings, 1 reply; 14+ messages in thread
From: Uwe Kleine-König @ 2023-10-09  8:38 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Maxime Coquelin, Alexandre Torgue, linux-gpio, linux-stm32,
	linux-arm-kernel, 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-stmfx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c
index d7ab82432a52..6313be370eb7 100644
--- a/drivers/pinctrl/pinctrl-stmfx.c
+++ b/drivers/pinctrl/pinctrl-stmfx.c
@@ -734,7 +734,7 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int stmfx_pinctrl_remove(struct platform_device *pdev)
+static void stmfx_pinctrl_remove(struct platform_device *pdev)
 {
 	struct stmfx *stmfx = dev_get_drvdata(pdev->dev.parent);
 	int ret;
@@ -746,8 +746,6 @@ static int stmfx_pinctrl_remove(struct platform_device *pdev)
 	if (ret)
 		dev_err(&pdev->dev, "Failed to disable pins (%pe)\n",
 			ERR_PTR(ret));
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -856,7 +854,7 @@ static struct platform_driver stmfx_pinctrl_driver = {
 		.pm = &stmfx_pinctrl_dev_pm_ops,
 	},
 	.probe = stmfx_pinctrl_probe,
-	.remove = stmfx_pinctrl_remove,
+	.remove_new = stmfx_pinctrl_remove,
 };
 module_platform_driver(stmfx_pinctrl_driver);
 
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 14+ 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; 14+ 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-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 01/20] pinctrl: stmfx: Improve error message in .remove()'s error path
  2023-10-09  8:38 ` [PATCH 01/20] pinctrl: stmfx: Improve error message in .remove()'s error path Uwe Kleine-König
@ 2023-10-10 13:35   ` Linus Walleij
  0 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2023-10-10 13:35 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Maxime Coquelin, Alexandre Torgue, linux-gpio, linux-stm32,
	linux-arm-kernel, linux-kernel

On Mon, Oct 9, 2023 at 11:22 AM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:


> The driver core has no handling for errors returned by the .remove()
> callback. The only action on error is a dev_warn() with generic error
> message that the returned value is returned.
>
> Replace it by a more specific and useful message. Then returning zero is
> the right thing to do, the only effect is to suppress the core's
> warning.
>
> This prepares the driver for the conversion to .remove_new().
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Patch applied.

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 02/20] pinctrl: single: Drop if block with always false condition
  2023-10-09  8:38 ` [PATCH 02/20] pinctrl: single: Drop if block with always false condition Uwe Kleine-König
@ 2023-10-10 13:36   ` Linus Walleij
  0 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2023-10-10 13:36 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Tony Lindgren, Haojian Zhuang, linux-arm-kernel, linux-omap,
	linux-gpio, linux-kernel

On Mon, Oct 9, 2023 at 11:22 AM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:


> pcs_remove() is only called after pcs_probe() completed successfully. In
> this case platform_set_drvdata() was called with a non-NULL argument and
> so platform_get_drvdata() won't return NULL.
>
> Simplify by removing the if block with the always false condition.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Patch applied.

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 07/20] pinctrl: nomadik: abx500: Convert to platform remove callback returning void
  2023-10-09  8:38 ` [PATCH 07/20] pinctrl: nomadik: abx500: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-10-10 13:38   ` Linus Walleij
  0 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2023-10-10 13:38 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: linux-arm-kernel, linux-gpio, 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-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ 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; 14+ 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-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 12/20] pinctrl: single: Convert to platform remove callback returning void
  2023-10-09  8:38 ` [PATCH 12/20] pinctrl: single: " Uwe Kleine-König
@ 2023-10-10 13:41   ` Linus Walleij
  0 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2023-10-10 13:41 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Tony Lindgren, Haojian Zhuang, linux-arm-kernel, linux-omap,
	linux-gpio, linux-kernel

On Mon, Oct 9, 2023 at 11:23 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-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 13/20] pinctrl: stmfx: Convert to platform remove callback returning void
  2023-10-09  8:38 ` [PATCH 13/20] pinctrl: stmfx: " Uwe Kleine-König
@ 2023-10-10 13:41   ` Linus Walleij
  0 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2023-10-10 13:41 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Maxime Coquelin, Alexandre Torgue, linux-gpio, linux-stm32,
	linux-arm-kernel, 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-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

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

Thread overview: 14+ 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 01/20] pinctrl: stmfx: Improve error message in .remove()'s error path Uwe Kleine-König
2023-10-10 13:35   ` Linus Walleij
2023-10-09  8:38 ` [PATCH 02/20] pinctrl: single: Drop if block with always false condition Uwe Kleine-König
2023-10-10 13:36   ` Linus Walleij
2023-10-09  8:38 ` [PATCH 07/20] pinctrl: nomadik: abx500: Convert to platform remove callback returning void Uwe Kleine-König
2023-10-10 13:38   ` Linus Walleij
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
2023-10-09  8:38 ` [PATCH 12/20] pinctrl: single: " Uwe Kleine-König
2023-10-10 13:41   ` Linus Walleij
2023-10-09  8:38 ` [PATCH 13/20] pinctrl: stmfx: " Uwe Kleine-König
2023-10-10 13:41   ` Linus Walleij

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