Skip to contentSkip to conversation

bus: Convert to platform remove callback returning void

PATCH Applied Uwe Kleine-König 7 participants 24 messages Nov 9, 2023 – Dec 6, 2023

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

cover bus: Convert to platform remove callback returning void

Hello,

this series converts all drivers below drivers/bus 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.

drivers/bus/fsl-mc was already addressed earlier with a separate series[1].

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

Some of the drivers touched here don't have a maintainer and there is no maintainer for all of drivers/bus. It would be great if someone could pick up the whole series, maybe Arnd might do that?

Best regards
Uwe

[1] https://lore.kernel.org/lkml/[email protected]

Uwe Kleine-König (12):
bus: hisi_lpc: Convert to platform remove callback returning void
bus: omap-ocp2scp: Convert to platform remove callback returning void
bus: omap_l3_smx: Convert to platform remove callback returning void
bus: qcom-ssc-block-bus: Convert to platform remove callback returning
void
bus: simple-pm-bus: Convert to platform remove callback returning void
bus: sun50i-de2: Convert to platform remove callback returning void
bus: sunxi-rsb: Convert to platform remove callback returning void
bus: tegra-aconnect: Convert to platform remove callback returning
void
bus: tegra-gmi: Convert to platform remove callback returning void
bus: ti-pwmss: Convert to platform remove callback returning void
bus: ti-sysc: Convert to platform remove callback returning void
bus: ts-nbus: Convert to platform remove callback returning void

 drivers/bus/hisi_lpc.c           | 6 ++----
 drivers/bus/omap-ocp2scp.c       | 6 ++----
 drivers/bus/omap_l3_smx.c        | 6 ++----
 drivers/bus/qcom-ssc-block-bus.c | 6 ++----
 drivers/bus/simple-pm-bus.c      | 7 +++----
 drivers/bus/sun50i-de2.c         | 5 ++---
 drivers/bus/sunxi-rsb.c          | 6 ++----
 drivers/bus/tegra-aconnect.c     | 6 ++----
 drivers/bus/tegra-gmi.c          | 6 ++----
 drivers/bus/ti-pwmss.c           | 5 ++---
 drivers/bus/ti-sysc.c            | 6 ++----
 drivers/bus/ts-nbus.c            | 6 ++----
 12 files changed, 25 insertions(+), 46 deletions(-)

base-commit: b622d91ca201bf97582e9b09ebbaab005ecee86f

Signature · 1 line
2.42.0
#1 lore raw

PATCH 1/12 bus: hisi_lpc: 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/bus/hisi_lpc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/bus/hisi_lpc.c +2 -4
index cdc4e38c113e..09340adbacc2 100644
@@ -657,7 +657,7 @@ static int hisi_lpc_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int hisi_lpc_remove(struct platform_device *pdev)
+static void hisi_lpc_remove(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct hisi_lpc_dev *lpcdev = dev_get_drvdata(dev);
@@ -669,8 +669,6 @@ static int hisi_lpc_remove(struct platform_device *pdev)
 		of_platform_depopulate(dev);
 
 	logic_pio_unregister_range(range);
-
-	return 0;
 }
 
 static const struct of_device_id hisi_lpc_of_match[] = {
@@ -691,6 +689,6 @@ static struct platform_driver hisi_lpc_driver = {
 		.acpi_match_table = hisi_lpc_acpi_match,
 	},
 	.probe = hisi_lpc_probe,
-	.remove = hisi_lpc_remove,
+	.remove_new = hisi_lpc_remove,
 };
 builtin_platform_driver(hisi_lpc_driver);
Signature · 1 line
2.42.0
#2 lore raw

PATCH 2/12 bus: omap-ocp2scp: 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/bus/omap-ocp2scp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/bus/omap-ocp2scp.c +2 -4
index e02d0656242b..7d7479ba0a75 100644
@@ -84,12 +84,10 @@ static int omap_ocp2scp_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int omap_ocp2scp_remove(struct platform_device *pdev)
+static void omap_ocp2scp_remove(struct platform_device *pdev)
 {
 	pm_runtime_disable(&pdev->dev);
 	device_for_each_child(&pdev->dev, NULL, ocp2scp_remove_devices);
-
-	return 0;
 }
 
 #ifdef CONFIG_OF
@@ -103,7 +101,7 @@ MODULE_DEVICE_TABLE(of, omap_ocp2scp_id_table);
 
 static struct platform_driver omap_ocp2scp_driver = {
 	.probe		= omap_ocp2scp_probe,
-	.remove		= omap_ocp2scp_remove,
+	.remove_new	= omap_ocp2scp_remove,
 	.driver		= {
 		.name	= "omap-ocp2scp",
 		.of_match_table = of_match_ptr(omap_ocp2scp_id_table),
Signature · 1 line
2.42.0
#3 lore raw

PATCH 3/12 bus: omap_l3_smx: 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/bus/omap_l3_smx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/bus/omap_l3_smx.c +2 -4
index 31774648be9d..ee6d29925e4d 100644
@@ -261,7 +261,7 @@ static int omap3_l3_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int omap3_l3_remove(struct platform_device *pdev)
+static void omap3_l3_remove(struct platform_device *pdev)
 {
 	struct omap3_l3         *l3 = platform_get_drvdata(pdev);
 
@@ -269,13 +269,11 @@ static int omap3_l3_remove(struct platform_device *pdev)
 	free_irq(l3->debug_irq, l3);
 	iounmap(l3->rt);
 	kfree(l3);
-
-	return 0;
 }
 
 static struct platform_driver omap3_l3_driver = {
 	.probe		= omap3_l3_probe,
-	.remove         = omap3_l3_remove,
+	.remove_new     = omap3_l3_remove,
 	.driver         = {
 		.name   = "omap_l3_smx",
 		.of_match_table = of_match_ptr(omap3_l3_match),
Signature · 1 line
2.42.0
maintainer Reviewed-by on v1 3/12
#4 lore raw

Re: [PATCH 03/12] bus: omap_l3_smx: Convert to platform remove callback returning void

Quoted 2 lines · Uwe Kleine-König

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

Please queue along with other bus related patches:

#5 lore raw

PATCH 4/12 bus: qcom-ssc-block-bus: 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/bus/qcom-ssc-block-bus.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/bus/qcom-ssc-block-bus.c +2 -4
index 3fef18a43c01..5931974a21fa 100644
@@ -350,7 +350,7 @@ static int qcom_ssc_block_bus_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int qcom_ssc_block_bus_remove(struct platform_device *pdev)
+static void qcom_ssc_block_bus_remove(struct platform_device *pdev)
 {
 	struct qcom_ssc_block_bus_data *data = platform_get_drvdata(pdev);
 
@@ -363,8 +363,6 @@ static int qcom_ssc_block_bus_remove(struct platform_device *pdev)
 	qcom_ssc_block_bus_pds_detach(&pdev->dev, data->pds, data->num_pds);
 	pm_runtime_disable(&pdev->dev);
 	pm_clk_destroy(&pdev->dev);
-
-	return 0;
 }
 
 static const struct of_device_id qcom_ssc_block_bus_of_match[] = {
@@ -375,7 +373,7 @@ MODULE_DEVICE_TABLE(of, qcom_ssc_block_bus_of_match);
 
 static struct platform_driver qcom_ssc_block_bus_driver = {
 	.probe = qcom_ssc_block_bus_probe,
-	.remove = qcom_ssc_block_bus_remove,
+	.remove_new = qcom_ssc_block_bus_remove,
 	.driver = {
 		.name = "qcom-ssc-block-bus",
 		.of_match_table = qcom_ssc_block_bus_of_match,
Signature · 1 line
2.42.0
#6 lore raw

PATCH 5/12 bus: simple-pm-bus: 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/bus/simple-pm-bus.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/bus/simple-pm-bus.c +3 -4
index aafcc481de91..50870c827889 100644
@@ -74,17 +74,16 @@ static int simple_pm_bus_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int simple_pm_bus_remove(struct platform_device *pdev)
+static void simple_pm_bus_remove(struct platform_device *pdev)
 {
 	const void *data = of_device_get_match_data(&pdev->dev);
 
 	if (pdev->driver_override || data)
-		return 0;
+		return;
 
 	dev_dbg(&pdev->dev, "%s\n", __func__);
 
 	pm_runtime_disable(&pdev->dev);
-	return 0;
 }
 
 static int simple_pm_bus_runtime_suspend(struct device *dev)
@@ -129,7 +128,7 @@ MODULE_DEVICE_TABLE(of, simple_pm_bus_of_match);
 
 static struct platform_driver simple_pm_bus_driver = {
 	.probe = simple_pm_bus_probe,
-	.remove = simple_pm_bus_remove,
+	.remove_new = simple_pm_bus_remove,
 	.driver = {
 		.name = "simple-pm-bus",
 		.of_match_table = simple_pm_bus_of_match,
Signature · 1 line
2.42.0
Reviewed-by on v1 5/12
#7 lore raw

Re: [PATCH 05/12] bus: simple-pm-bus: Convert to platform remove callback returning void

Quoted 10 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.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#8 lore raw

PATCH 6/12 bus: sun50i-de2: 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/bus/sun50i-de2.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/bus/sun50i-de2.c +2 -3
index 414f29cdedf0..3339311ce068 100644
@@ -24,10 +24,9 @@ static int sun50i_de2_bus_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int sun50i_de2_bus_remove(struct platform_device *pdev)
+static void sun50i_de2_bus_remove(struct platform_device *pdev)
 {
 	sunxi_sram_release(&pdev->dev);
-	return 0;
 }
 
 static const struct of_device_id sun50i_de2_bus_of_match[] = {
@@ -37,7 +36,7 @@ static const struct of_device_id sun50i_de2_bus_of_match[] = {
 
 static struct platform_driver sun50i_de2_bus_driver = {
 	.probe = sun50i_de2_bus_probe,
-	.remove = sun50i_de2_bus_remove,
+	.remove_new = sun50i_de2_bus_remove,
 	.driver = {
 		.name = "sun50i-de2-bus",
 		.of_match_table = sun50i_de2_bus_of_match,
Signature · 1 line
2.42.0
Reviewed-by on v1 6/12
#9 lore raw

Re: [PATCH 06/12] bus: sun50i-de2: Convert to platform remove callback returning void

On Thu, 9 Nov 2023 21:28:36 +0100
Uwe Kleine-König <[email protected]> wrote:

Hi,

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 4 lines

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

Cheers,
Andre

Quoted 29 lines
---
 drivers/bus/sun50i-de2.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/bus/sun50i-de2.c +2 -3
index 414f29cdedf0..3339311ce068 100644
@@ -24,10 +24,9 @@ static int sun50i_de2_bus_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int sun50i_de2_bus_remove(struct platform_device *pdev)
+static void sun50i_de2_bus_remove(struct platform_device *pdev)
 {
 	sunxi_sram_release(&pdev->dev);
-	return 0;
 }
 
 static const struct of_device_id sun50i_de2_bus_of_match[] = {
@@ -37,7 +36,7 @@ static const struct of_device_id sun50i_de2_bus_of_match[] = {
 
 static struct platform_driver sun50i_de2_bus_driver = {
 	.probe = sun50i_de2_bus_probe,
-	.remove = sun50i_de2_bus_remove,
+	.remove_new = sun50i_de2_bus_remove,
 	.driver = {
 		.name = "sun50i-de2-bus",
 		.of_match_table = sun50i_de2_bus_of_match,
maintainer Reviewed-by on v1 6/12
#10 lore raw

Re: [PATCH 06/12] bus: sun50i-de2: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

Dne četrtek, 09. november 2023 ob 21:28:36 CET je Uwe Kleine-König napisal(a):

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 4 lines

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

Best regards,
Jernej

Quoted 30 lines
---
 drivers/bus/sun50i-de2.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/bus/sun50i-de2.c +2 -3
index 414f29cdedf0..3339311ce068 100644
@@ -24,10 +24,9 @@ static int sun50i_de2_bus_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int sun50i_de2_bus_remove(struct platform_device *pdev)
+static void sun50i_de2_bus_remove(struct platform_device *pdev)
 {
 	sunxi_sram_release(&pdev->dev);
-	return 0;
 }
 
 static const struct of_device_id sun50i_de2_bus_of_match[] = {
@@ -37,7 +36,7 @@ static const struct of_device_id sun50i_de2_bus_of_match[] = {
 
 static struct platform_driver sun50i_de2_bus_driver = {
 	.probe = sun50i_de2_bus_probe,
-	.remove = sun50i_de2_bus_remove,
+	.remove_new = sun50i_de2_bus_remove,
 	.driver = {
 		.name = "sun50i-de2-bus",
 		.of_match_table = sun50i_de2_bus_of_match,
#11 lore raw

PATCH 7/12 bus: sunxi-rsb: 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/bus/sunxi-rsb.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/bus/sunxi-rsb.c +2 -4
index db0ed4e5d315..fd3e9d82340a 100644
@@ -817,15 +817,13 @@ static int sunxi_rsb_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int sunxi_rsb_remove(struct platform_device *pdev)
+static void sunxi_rsb_remove(struct platform_device *pdev)
 {
 	struct sunxi_rsb *rsb = platform_get_drvdata(pdev);
 
 	device_for_each_child(rsb->dev, NULL, sunxi_rsb_remove_devices);
 	pm_runtime_disable(&pdev->dev);
 	sunxi_rsb_hw_exit(rsb);
-
-	return 0;
 }
 
 static const struct dev_pm_ops sunxi_rsb_dev_pm_ops = {
@@ -842,7 +840,7 @@ MODULE_DEVICE_TABLE(of, sunxi_rsb_of_match_table);
 
 static struct platform_driver sunxi_rsb_driver = {
 	.probe = sunxi_rsb_probe,
-	.remove	= sunxi_rsb_remove,
+	.remove_new = sunxi_rsb_remove,
 	.driver	= {
 		.name = RSB_CTRL_NAME,
 		.of_match_table = sunxi_rsb_of_match_table,
Signature · 1 line
2.42.0
Reviewed-by on v1 7/12
#12 lore raw

Re: [PATCH 07/12] bus: sunxi-rsb: Convert to platform remove callback returning void

Quoted 10 lines · On Thu, 9 Nov 2023 21:28:37 +0100 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.

Thanks,
Andre

Quoted 34 lines
---
 drivers/bus/sunxi-rsb.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/bus/sunxi-rsb.c +2 -4
index db0ed4e5d315..fd3e9d82340a 100644
@@ -817,15 +817,13 @@ static int sunxi_rsb_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int sunxi_rsb_remove(struct platform_device *pdev)
+static void sunxi_rsb_remove(struct platform_device *pdev)
 {
 	struct sunxi_rsb *rsb = platform_get_drvdata(pdev);
 
 	device_for_each_child(rsb->dev, NULL, sunxi_rsb_remove_devices);
 	pm_runtime_disable(&pdev->dev);
 	sunxi_rsb_hw_exit(rsb);
-
-	return 0;
 }
 
 static const struct dev_pm_ops sunxi_rsb_dev_pm_ops = {
@@ -842,7 +840,7 @@ MODULE_DEVICE_TABLE(of, sunxi_rsb_of_match_table);
 
 static struct platform_driver sunxi_rsb_driver = {
 	.probe = sunxi_rsb_probe,
-	.remove	= sunxi_rsb_remove,
+	.remove_new = sunxi_rsb_remove,
 	.driver	= {
 		.name = RSB_CTRL_NAME,
 		.of_match_table = sunxi_rsb_of_match_table,
maintainer Reviewed-by on v1 7/12
#13 lore raw

Re: [PATCH 07/12] bus: sunxi-rsb: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

Dne četrtek, 09. november 2023 ob 21:28:37 CET je Uwe Kleine-König napisal(a):

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 4 lines

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

Best regards,
Jernej

Quoted 35 lines
---
 drivers/bus/sunxi-rsb.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/bus/sunxi-rsb.c +2 -4
index db0ed4e5d315..fd3e9d82340a 100644
@@ -817,15 +817,13 @@ static int sunxi_rsb_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int sunxi_rsb_remove(struct platform_device *pdev)
+static void sunxi_rsb_remove(struct platform_device *pdev)
 {
 	struct sunxi_rsb *rsb = platform_get_drvdata(pdev);
 
 	device_for_each_child(rsb->dev, NULL, sunxi_rsb_remove_devices);
 	pm_runtime_disable(&pdev->dev);
 	sunxi_rsb_hw_exit(rsb);
-
-	return 0;
 }
 
 static const struct dev_pm_ops sunxi_rsb_dev_pm_ops = {
@@ -842,7 +840,7 @@ MODULE_DEVICE_TABLE(of, sunxi_rsb_of_match_table);
 
 static struct platform_driver sunxi_rsb_driver = {
 	.probe = sunxi_rsb_probe,
-	.remove	= sunxi_rsb_remove,
+	.remove_new = sunxi_rsb_remove,
 	.driver	= {
 		.name = RSB_CTRL_NAME,
 		.of_match_table = sunxi_rsb_of_match_table,
#14 lore raw

PATCH 8/12 bus: tegra-aconnect: 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/bus/tegra-aconnect.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/bus/tegra-aconnect.c +2 -4
index ac58142301f4..de80008bff92 100644
@@ -53,11 +53,9 @@ static int tegra_aconnect_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int tegra_aconnect_remove(struct platform_device *pdev)
+static void tegra_aconnect_remove(struct platform_device *pdev)
 {
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 static int tegra_aconnect_runtime_resume(struct device *dev)
@@ -106,7 +104,7 @@ MODULE_DEVICE_TABLE(of, tegra_aconnect_of_match);
 
 static struct platform_driver tegra_aconnect_driver = {
 	.probe = tegra_aconnect_probe,
-	.remove = tegra_aconnect_remove,
+	.remove_new = tegra_aconnect_remove,
 	.driver = {
 		.name = "tegra-aconnect",
 		.of_match_table = tegra_aconnect_of_match,
Signature · 1 line
2.42.0
#15 lore raw

PATCH 9/12 bus: tegra-gmi: 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/bus/tegra-gmi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/bus/tegra-gmi.c +2 -4
index 59919e99f7cc..f5d6414df9f2 100644
@@ -258,14 +258,12 @@ static int tegra_gmi_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int tegra_gmi_remove(struct platform_device *pdev)
+static void tegra_gmi_remove(struct platform_device *pdev)
 {
 	struct tegra_gmi *gmi = platform_get_drvdata(pdev);
 
 	of_platform_depopulate(gmi->dev);
 	tegra_gmi_disable(gmi);
-
-	return 0;
 }
 
 static int __maybe_unused tegra_gmi_runtime_resume(struct device *dev)
@@ -305,7 +303,7 @@ MODULE_DEVICE_TABLE(of, tegra_gmi_id_table);
 
 static struct platform_driver tegra_gmi_driver = {
 	.probe = tegra_gmi_probe,
-	.remove = tegra_gmi_remove,
+	.remove_new = tegra_gmi_remove,
 	.driver = {
 		.name		= "tegra-gmi",
 		.of_match_table	= tegra_gmi_id_table,
Signature · 1 line
2.42.0
#16 lore raw

PATCH 10/12 bus: ti-pwmss: 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/bus/ti-pwmss.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/bus/ti-pwmss.c +2 -3
index 480a4de76cd4..4969c556e752 100644
@@ -33,10 +33,9 @@ static int pwmss_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int pwmss_remove(struct platform_device *pdev)
+static void pwmss_remove(struct platform_device *pdev)
 {
 	pm_runtime_disable(&pdev->dev);
-	return 0;
 }
 
 static struct platform_driver pwmss_driver = {
@@ -45,7 +44,7 @@ static struct platform_driver pwmss_driver = {
 		.of_match_table	= pwmss_of_match,
 	},
 	.probe	= pwmss_probe,
-	.remove	= pwmss_remove,
+	.remove_new = pwmss_remove,
 };
 
 module_platform_driver(pwmss_driver);
Signature · 1 line
2.42.0
#17 lore raw

PATCH 11/12 bus: ti-sysc: 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/bus/ti-sysc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/bus/ti-sysc.c +2 -4
index d57bc066dce6..490841dbe0d8 100644
@@ -3387,7 +3387,7 @@ static int sysc_probe(struct platform_device *pdev)
 	return error;
 }
 
-static int sysc_remove(struct platform_device *pdev)
+static void sysc_remove(struct platform_device *pdev)
 {
 	struct sysc *ddata = platform_get_drvdata(pdev);
 	int error;
@@ -3412,8 +3412,6 @@ static int sysc_remove(struct platform_device *pdev)
 
 unprepare:
 	sysc_unprepare(ddata);
-
-	return 0;
 }
 
 static const struct of_device_id sysc_match[] = {
@@ -3439,7 +3437,7 @@ MODULE_DEVICE_TABLE(of, sysc_match);
 
 static struct platform_driver sysc_driver = {
 	.probe		= sysc_probe,
-	.remove		= sysc_remove,
+	.remove_new	= sysc_remove,
 	.driver         = {
 		.name   = "ti-sysc",
 		.of_match_table	= sysc_match,
Signature · 1 line
2.42.0
maintainer Reviewed-by on v1 11/12
#18 lore raw

Re: [PATCH 11/12] bus: ti-sysc: Convert to platform remove callback returning void

Quoted 2 lines · Uwe Kleine-König

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

Looks good to me, please queue along with your other patches:

#19 lore raw

PATCH 12/12 bus: ts-nbus: 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/bus/ts-nbus.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/bus/ts-nbus.c +2 -4
index 38c886dc2ed6..4fa932cb0915 100644
@@ -331,7 +331,7 @@ static int ts_nbus_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int ts_nbus_remove(struct platform_device *pdev)
+static void ts_nbus_remove(struct platform_device *pdev)
 {
 	struct ts_nbus *ts_nbus = dev_get_drvdata(&pdev->dev);
 
@@ -339,8 +339,6 @@ static int ts_nbus_remove(struct platform_device *pdev)
 	mutex_lock(&ts_nbus->lock);
 	pwm_disable(ts_nbus->pwm);
 	mutex_unlock(&ts_nbus->lock);
-
-	return 0;
 }
 
 static const struct of_device_id ts_nbus_of_match[] = {
@@ -351,7 +349,7 @@ MODULE_DEVICE_TABLE(of, ts_nbus_of_match);
 
 static struct platform_driver ts_nbus_driver = {
 	.probe		= ts_nbus_probe,
-	.remove		= ts_nbus_remove,
+	.remove_new	= ts_nbus_remove,
 	.driver		= {
 		.name	= "ts_nbus",
 		.of_match_table = ts_nbus_of_match,
Signature · 1 line
2.42.0
#20 lore raw
In reply to Uwe Kleine-König
Quoted 10 lines · Uwe Kleine-König

Hello,

this series converts all drivers below drivers/bus 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.

drivers/bus/fsl-mc was already addressed earlier with a separate series[1].

Quoted 6 lines

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

Some of the drivers touched here don't have a maintainer and there is no maintainer for all of drivers/bus. It would be great if someone could pick up the whole series, maybe Arnd might do that?

Sure, please send a pull request to [email protected] if there are no further comments.

Arnd

#21 lore raw

Hello Arnd,

Quoted 12 lines · Arnd Bergmann
Quoted 11 lines · Uwe Kleine-König

this series converts all drivers below drivers/bus 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.

drivers/bus/fsl-mc was already addressed earlier with a separate series[1].

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

Quoted 6 lines
Quoted 3 lines

Some of the drivers touched here don't have a maintainer and there is no maintainer for all of drivers/bus. It would be great if someone could pick up the whole series, maybe Arnd might do that?

Sure, please send a pull request to [email protected] if there are no further comments.

here it comes:

The following changes since commit b85ea95d086471afb4ad062012a4d73cd328fa86:

Linux 6.7-rc1 (2023-11-12 16:19:07 -0800)

are available in the Git repository at:

https://git.pengutronix.de/git/ukl/linux tags/bus-platform-remove-void

for you to fetch changes up to 7d6da8800a35d2257ff8b4b7d7c4551978f0a71a:

bus: ts-nbus: Convert to platform remove callback returning void (2023-11-16 12:43:57 +0100)

----------------------------------------------------------------
This series converts all drivers below drivers/bus 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.

After the initial simplification in commit 864acca58000 ("bus: fsl-mc:
Drop if block with always false condition") all conversations are trivial because the remove callbacks all return zero unconditionally.

----------------------------------------------------------------
Uwe Kleine-König (14):
bus: fsl-mc: Drop if block with always false condition
bus: fsl-mc: Convert to platform remove callback returning void
bus: hisi_lpc: Convert to platform remove callback returning void
bus: omap-ocp2scp: Convert to platform remove callback returning void
bus: omap_l3_smx: Convert to platform remove callback returning void
bus: qcom-ssc-block-bus: Convert to platform remove callback returning void
bus: simple-pm-bus: Convert to platform remove callback returning void
bus: sun50i-de2: Convert to platform remove callback returning void
bus: sunxi-rsb: Convert to platform remove callback returning void
bus: tegra-aconnect: Convert to platform remove callback returning void
bus: tegra-gmi: Convert to platform remove callback returning void
bus: ti-pwmss: Convert to platform remove callback returning void
bus: ti-sysc: Convert to platform remove callback returning void
bus: ts-nbus: Convert to platform remove callback returning void

 drivers/bus/fsl-mc/fsl-mc-bus.c  | 16 +++-------------
 drivers/bus/hisi_lpc.c           |  6 ++----
 drivers/bus/omap-ocp2scp.c       |  6 ++----
 drivers/bus/omap_l3_smx.c        |  6 ++----
 drivers/bus/qcom-ssc-block-bus.c |  6 ++----
 drivers/bus/simple-pm-bus.c      |  7 +++----
 drivers/bus/sun50i-de2.c         |  5 ++---
 drivers/bus/sunxi-rsb.c          |  6 ++----
 drivers/bus/tegra-aconnect.c     |  6 ++----
 drivers/bus/tegra-gmi.c          |  6 ++----
 drivers/bus/ti-pwmss.c           |  5 ++---
 drivers/bus/ti-sysc.c            |  6 ++----
 drivers/bus/ts-nbus.c            |  6 ++----
 13 files changed, 28 insertions(+), 59 deletions(-)

Thanks for considering these changes,
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#22 lore raw

Hello Arnd,

Quoted 17 lines · Uwe Kleine-König
Quoted 16 lines · Arnd Bergmann
Quoted 14 lines · Uwe Kleine-König

this series converts all drivers below drivers/bus 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.

drivers/bus/fsl-mc was already addressed earlier with a separate series[1].

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

Some of the drivers touched here don't have a maintainer and there is no maintainer for all of drivers/bus. It would be great if someone could pick up the whole series, maybe Arnd might do that?

Quoted 8 lines
Quoted 2 lines

Sure, please send a pull request to [email protected] if there are no further comments.

here it comes:

The following changes since commit b85ea95d086471afb4ad062012a4d73cd328fa86:

Linux 6.7-rc1 (2023-11-12 16:19:07 -0800)

Here comes an updated PR. The only change is that it also includes two Reviewed-by tags for Jernej Skrabec that came in after I sent the PR. Obviously that changed the commit hash which made it necessary to redo the PR. I hope it doesn't disturb your tooling that there are now two similar pull requests.

Best regards
Uwe

The following changes since commit b85ea95d086471afb4ad062012a4d73cd328fa86:

Linux 6.7-rc1 (2023-11-12 16:19:07 -0800)

are available in the Git repository at:

https://git.pengutronix.de/git/ukl/linux tags/bus-platform-remove-void

for you to fetch changes up to fc540426f7baa0c7d4b477e80435d075659092a2:

bus: ts-nbus: Convert to platform remove callback returning void (2023-11-28 18:43:27 +0100)

----------------------------------------------------------------
This series converts all drivers below drivers/bus 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.

After the initial simplification in commit 864acca58000 ("bus: fsl-mc:
Drop if block with always false condition") all conversations are trivial because the remove callbacks all return zero unconditionally.

----------------------------------------------------------------
Uwe Kleine-König (14):
bus: fsl-mc: Drop if block with always false condition
bus: fsl-mc: Convert to platform remove callback returning void
bus: hisi_lpc: Convert to platform remove callback returning void
bus: omap-ocp2scp: Convert to platform remove callback returning void
bus: omap_l3_smx: Convert to platform remove callback returning void
bus: qcom-ssc-block-bus: Convert to platform remove callback returning void
bus: simple-pm-bus: Convert to platform remove callback returning void
bus: sun50i-de2: Convert to platform remove callback returning void
bus: sunxi-rsb: Convert to platform remove callback returning void
bus: tegra-aconnect: Convert to platform remove callback returning void
bus: tegra-gmi: Convert to platform remove callback returning void
bus: ti-pwmss: Convert to platform remove callback returning void
bus: ti-sysc: Convert to platform remove callback returning void
bus: ts-nbus: Convert to platform remove callback returning void

 drivers/bus/fsl-mc/fsl-mc-bus.c  | 16 +++-------------
 drivers/bus/hisi_lpc.c           |  6 ++----
 drivers/bus/omap-ocp2scp.c       |  6 ++----
 drivers/bus/omap_l3_smx.c        |  6 ++----
 drivers/bus/qcom-ssc-block-bus.c |  6 ++----
 drivers/bus/simple-pm-bus.c      |  7 +++----
 drivers/bus/sun50i-de2.c         |  5 ++---
 drivers/bus/sunxi-rsb.c          |  6 ++----
 drivers/bus/tegra-aconnect.c     |  6 ++----
 drivers/bus/tegra-gmi.c          |  6 ++----
 drivers/bus/ti-pwmss.c           |  5 ++---
 drivers/bus/ti-sysc.c            |  6 ++----
 drivers/bus/ts-nbus.c            |  6 ++----
 13 files changed, 28 insertions(+), 59 deletions(-)
Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#23 lore raw
This pull request was applied to soc/soc.git (for-next) by Arnd Bergmann <[email protected]>:

Hello:

This pull request was applied to soc/soc.git (for-next) by Arnd Bergmann <[email protected]>:

Quoted 23 lines · On Tue, 28 Nov 2023 18:49:27 +0100 you wrote:

Hello Arnd,

Quoted 20 lines · Uwe Kleine-König
Quoted 18 lines · Arnd Bergmann
Quoted 8 lines · Uwe Kleine-König

this series converts all drivers below drivers/bus 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.

drivers/bus/fsl-mc was already addressed earlier with a separate series[1].

Quoted 6 lines

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

Some of the drivers touched here don't have a maintainer and there is no maintainer for all of drivers/bus. It would be great if someone could pick up the whole series, maybe Arnd might do that?

Sure, please send a pull request to [email protected] if there are no further comments.

Quoted 7 lines
Quoted 5 lines

here it comes:

The following changes since commit b85ea95d086471afb4ad062012a4d73cd328fa86:

Linux 6.7-rc1 (2023-11-12 16:19:07 -0800)

[...]

Here is the summary with links:
- [PULL,v2] bus: Convert to platform remove callback returning void

    https://git.kernel.org/soc/soc/c/a351940d61e6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html