Skip to contentSkip to conversation

clk: Convert to platform remove callback returning void

PATCH Applied Uwe Kleine-König 3 participants 9 messages Mar 6, 2024 – Mar 8, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover clk: Convert to platform remove callback returning void

Hello,

this series converts all platform drivers below drivers/clk that were introduced after my last clk converstion[1] to struct platform_driver::remove_new(). See commit 5c5a7680e67b ("platform:
Provide a remove callback that returns no value") for an extended explanation and the eventual goal.

All conversations are trivial, because their .remove() callbacks returned zero unconditionally.

There are no interdependencies between these patches, so they could be picked up individually. But I'd hope that they get picked up all together by the clk maintainers.

Best regards
Uwe

[1] https://lore.kernel.org/linux-clk/[email protected]/

Uwe Kleine-König (3):
clk: imx: imx8-acm: Convert to platform remove callback returning void
clk: starfive: jh7110-isp: Convert to platform remove callback returning void
clk: starfive: jh7110-vout: Convert to platform remove callback returning void

 drivers/clk/imx/clk-imx8-acm.c                  | 6 ++----
 drivers/clk/starfive/clk-starfive-jh7110-isp.c  | 6 ++----
 drivers/clk/starfive/clk-starfive-jh7110-vout.c | 6 ++----
 3 files changed, 6 insertions(+), 12 deletions(-)

base-commit: 11afac187274a6177a7ac82997f8691c0f469e41

Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/3 clk: imx: imx8-acm: Convert to platform remove callback returning void

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.

---
 drivers/clk/imx/clk-imx8-acm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/clk/imx/clk-imx8-acm.c +2 -4
index f68877eef873..1bdb480cc96c 100644
@@ -394,15 +394,13 @@ static int imx8_acm_clk_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int imx8_acm_clk_remove(struct platform_device *pdev)
+static void imx8_acm_clk_remove(struct platform_device *pdev)
 {
 	struct imx8_acm_priv *priv = dev_get_drvdata(&pdev->dev);
 
 	pm_runtime_disable(&pdev->dev);
 
 	clk_imx_acm_detach_pm_domains(&pdev->dev, &priv->dev_pm);
-
-	return 0;
 }
 
 static const struct imx8_acm_soc_data imx8qm_acm_data = {
@@ -470,7 +468,7 @@ static struct platform_driver imx8_acm_clk_driver = {
 		.pm = &imx8_acm_pm_ops,
 	},
 	.probe = imx8_acm_clk_probe,
-	.remove = imx8_acm_clk_remove,
+	.remove_new = imx8_acm_clk_remove,
 };
 module_platform_driver(imx8_acm_clk_driver);
 
Signature · 1 line
2.43.0
maintainer Applied
#2 lore raw

Re: [PATCH 1/3] clk: imx: imx8-acm: Convert to platform remove callback returning void

Quoting Uwe Kleine-König (2024-03-06 02:38:55)

Quoted 10 lines

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

Quoted 5 lines

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---

Applied to clk-next

#3 lore raw

PATCH 2/3 clk: starfive: jh7110-isp: Convert to platform remove callback returning void

In reply to 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.

---
 drivers/clk/starfive/clk-starfive-jh7110-isp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/clk/starfive/clk-starfive-jh7110-isp.c +2 -4
index 929b8788279e..d3c85421f948 100644
@@ -202,12 +202,10 @@ static int jh7110_ispcrg_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int jh7110_ispcrg_remove(struct platform_device *pdev)
+static void jh7110_ispcrg_remove(struct platform_device *pdev)
 {
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 static const struct of_device_id jh7110_ispcrg_match[] = {
@@ -218,7 +216,7 @@ MODULE_DEVICE_TABLE(of, jh7110_ispcrg_match);
 
 static struct platform_driver jh7110_ispcrg_driver = {
 	.probe = jh7110_ispcrg_probe,
-	.remove = jh7110_ispcrg_remove,
+	.remove_new = jh7110_ispcrg_remove,
 	.driver = {
 		.name = "clk-starfive-jh7110-isp",
 		.of_match_table = jh7110_ispcrg_match,
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 2/3
#4 lore raw

RE: [PATCH 2/3] clk: starfive: jh7110-isp: Convert to platform remove callback returning void

Quoted 12 lines · 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().

Quoted 4 lines

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

maintainer Applied
#5 lore raw

Re: [PATCH 2/3] clk: starfive: jh7110-isp: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

Quoting Uwe Kleine-König (2024-03-06 02:38:56)

Quoted 10 lines

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

Quoted 5 lines

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---

Applied to clk-next

#6 lore raw

PATCH 3/3 clk: starfive: jh7110-vout: Convert to platform remove callback returning void

In reply to 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.

---
 drivers/clk/starfive/clk-starfive-jh7110-vout.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/clk/starfive/clk-starfive-jh7110-vout.c +2 -4
index 10cc1ec43925..53f7af234cc2 100644
@@ -209,12 +209,10 @@ static int jh7110_voutcrg_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int jh7110_voutcrg_remove(struct platform_device *pdev)
+static void jh7110_voutcrg_remove(struct platform_device *pdev)
 {
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 static const struct of_device_id jh7110_voutcrg_match[] = {
@@ -225,7 +223,7 @@ MODULE_DEVICE_TABLE(of, jh7110_voutcrg_match);
 
 static struct platform_driver jh7110_voutcrg_driver = {
 	.probe = jh7110_voutcrg_probe,
-	.remove = jh7110_voutcrg_remove,
+	.remove_new = jh7110_voutcrg_remove,
 	.driver = {
 		.name = "clk-starfive-jh7110-vout",
 		.of_match_table = jh7110_voutcrg_match,
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 3/3
#7 lore raw

RE: [PATCH 3/3] clk: starfive: jh7110-vout: Convert to platform remove callback returning void

Quoted 12 lines · 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().

Quoted 4 lines

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

maintainer Applied
#8 lore raw

Re: [PATCH 3/3] clk: starfive: jh7110-vout: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

Quoting Uwe Kleine-König (2024-03-06 02:38:57)

Quoted 10 lines

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

Quoted 5 lines

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---

Applied to clk-next