[PATCH 00/20] pinctrl: Convert to platform remove callback returning void
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
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/cirrus/pinctrl-madera-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/cirrus/pinctrl-madera-core.c b/drivers/pinctrl/cirrus/pinctrl-madera-core.c index bb589922d8c5..898b197c3738 100644 --- a/drivers/pinctrl/cirrus/pinctrl-madera-core.c +++ b/drivers/pinctrl/cirrus/pinctrl-madera-core.c @@ -1084,19 +1084,17 @@ static int madera_pin_probe(struct platform_device *pdev) return 0; }
-static int madera_pin_remove(struct platform_device *pdev) +static void madera_pin_remove(struct platform_device *pdev) { struct madera_pin_private *priv = platform_get_drvdata(pdev);
if (priv->madera->pdata.gpio_configs) pinctrl_unregister_mappings(priv->madera->pdata.gpio_configs); - - return 0; }
static struct platform_driver madera_pin_driver = { .probe = madera_pin_probe, - .remove = madera_pin_remove, + .remove_new = madera_pin_remove, .driver = { .name = "madera-pinctrl", },
On Mon, Oct 09, 2023 at 10:38:40AM +0200, 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 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
Acked-by: Charles Keepax ckeepax@opensource.cirrus.com
Thanks, Charles
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
participants (3)
-
Charles Keepax
-
Linus Walleij
-
Uwe Kleine-König