2023-09-28 07:21:25

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 00/23] gpio: Convert to platform remove callback returning void

Hello,

this series converts all platform drivers below drivers/gpio to use
.remove_new(). The motivation is to get rid of an integer return code
that is (mostly) ignored by the platform driver core and error prone on
the driver side.

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

There are no interdependencies between the patches. 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 subject prefix is suboptimal, please apply the remainder of
this series anyhow.

Best regards
Uwe

Uwe Kleine-König (23):
gpio: altera: Convert to platform remove callback returning void
gpio: amdpt: Convert to platform remove callback returning void
gpio: brcmstb: Convert to platform remove callback returning void
gpio: cadence: Convert to platform remove callback returning void
gpio: dln2: Convert to platform remove callback returning void
gpio: ftgpio010: Convert to platform remove callback returning void
gpio: grgpio: Convert to platform remove callback returning void
gpio: ljca: Convert to platform remove callback returning void
gpio: lpc18xx: Convert to platform remove callback returning void
gpio: mb86s7x: Convert to platform remove callback returning void
gpio: mm-lantiq: Convert to platform remove callback returning void
gpio: mpc5200: Convert to platform remove callback returning void
gpio: mpc8xxx: Convert to platform remove callback returning void
gpio: omap: Convert to platform remove callback returning void
gpio: rcar: Convert to platform remove callback returning void
gpio: rockchip: Convert to platform remove callback returning void
gpio: tb10x: Convert to platform remove callback returning void
gpio: ts5500: Convert to platform remove callback returning void
gpio: uniphier: Convert to platform remove callback returning void
gpio: xgene-sb: Convert to platform remove callback returning void
gpio: xgs-iproc: Convert to platform remove callback returning void
gpio: xilinx: Convert to platform remove callback returning void
gpio: zynq: Convert to platform remove callback returning void

drivers/gpio/gpio-altera.c | 6 ++----
drivers/gpio/gpio-amdpt.c | 6 ++----
drivers/gpio/gpio-brcmstb.c | 6 ++----
drivers/gpio/gpio-cadence.c | 6 ++----
drivers/gpio/gpio-dln2.c | 6 ++----
drivers/gpio/gpio-ftgpio010.c | 6 ++----
drivers/gpio/gpio-grgpio.c | 6 ++----
drivers/gpio/gpio-ljca.c | 5 ++---
drivers/gpio/gpio-lpc18xx.c | 6 ++----
drivers/gpio/gpio-mb86s7x.c | 6 ++----
drivers/gpio/gpio-mm-lantiq.c | 6 ++----
drivers/gpio/gpio-mpc5200.c | 8 +++-----
drivers/gpio/gpio-mpc8xxx.c | 6 ++----
drivers/gpio/gpio-omap.c | 6 ++----
drivers/gpio/gpio-rcar.c | 5 ++---
drivers/gpio/gpio-rockchip.c | 6 ++----
drivers/gpio/gpio-tb10x.c | 6 ++----
drivers/gpio/gpio-ts5500.c | 6 ++----
drivers/gpio/gpio-uniphier.c | 6 ++----
drivers/gpio/gpio-xgene-sb.c | 6 ++----
drivers/gpio/gpio-xgs-iproc.c | 6 ++----
drivers/gpio/gpio-xilinx.c | 6 ++----
drivers/gpio/gpio-zynq.c | 5 ++---
23 files changed, 47 insertions(+), 90 deletions(-)


base-commit: 719136e5c24768ebdf80b9daa53facebbdd377c3
--
2.40.1


2023-09-28 07:21:25

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 09/23] gpio: lpc18xx: 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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/gpio/gpio-lpc18xx.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-lpc18xx.c b/drivers/gpio/gpio-lpc18xx.c
index ed3f653a1dfc..5c6bb57a8c99 100644
--- a/drivers/gpio/gpio-lpc18xx.c
+++ b/drivers/gpio/gpio-lpc18xx.c
@@ -381,7 +381,7 @@ static int lpc18xx_gpio_probe(struct platform_device *pdev)
return 0;
}

-static int lpc18xx_gpio_remove(struct platform_device *pdev)
+static void lpc18xx_gpio_remove(struct platform_device *pdev)
{
struct lpc18xx_gpio_chip *gc = platform_get_drvdata(pdev);

@@ -389,8 +389,6 @@ static int lpc18xx_gpio_remove(struct platform_device *pdev)
irq_domain_remove(gc->pin_ic->domain);

clk_disable_unprepare(gc->clk);
-
- return 0;
}

static const struct of_device_id lpc18xx_gpio_match[] = {
@@ -401,7 +399,7 @@ MODULE_DEVICE_TABLE(of, lpc18xx_gpio_match);

static struct platform_driver lpc18xx_gpio_driver = {
.probe = lpc18xx_gpio_probe,
- .remove = lpc18xx_gpio_remove,
+ .remove_new = lpc18xx_gpio_remove,
.driver = {
.name = "lpc18xx-gpio",
.of_match_table = lpc18xx_gpio_match,
--
2.40.1

2023-09-28 07:21:26

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 17/23] gpio: tb10x: 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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/gpio/gpio-tb10x.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-tb10x.c b/drivers/gpio/gpio-tb10x.c
index f96d260a4a19..e8c1485b9c73 100644
--- a/drivers/gpio/gpio-tb10x.c
+++ b/drivers/gpio/gpio-tb10x.c
@@ -215,7 +215,7 @@ static int tb10x_gpio_probe(struct platform_device *pdev)
return ret;
}

-static int tb10x_gpio_remove(struct platform_device *pdev)
+static void tb10x_gpio_remove(struct platform_device *pdev)
{
struct tb10x_gpio *tb10x_gpio = platform_get_drvdata(pdev);

@@ -225,8 +225,6 @@ static int tb10x_gpio_remove(struct platform_device *pdev)
kfree(tb10x_gpio->domain->gc);
irq_domain_remove(tb10x_gpio->domain);
}
-
- return 0;
}

static const struct of_device_id tb10x_gpio_dt_ids[] = {
@@ -237,7 +235,7 @@ MODULE_DEVICE_TABLE(of, tb10x_gpio_dt_ids);

static struct platform_driver tb10x_gpio_driver = {
.probe = tb10x_gpio_probe,
- .remove = tb10x_gpio_remove,
+ .remove_new = tb10x_gpio_remove,
.driver = {
.name = "tb10x-gpio",
.of_match_table = tb10x_gpio_dt_ids,
--
2.40.1

2023-09-28 07:21:27

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 02/23] gpio: amdpt: 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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/gpio/gpio-amdpt.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-amdpt.c b/drivers/gpio/gpio-amdpt.c
index 07c6d090058d..0a2ea9db4682 100644
--- a/drivers/gpio/gpio-amdpt.c
+++ b/drivers/gpio/gpio-amdpt.c
@@ -122,13 +122,11 @@ static int pt_gpio_probe(struct platform_device *pdev)
return ret;
}

-static int pt_gpio_remove(struct platform_device *pdev)
+static void pt_gpio_remove(struct platform_device *pdev)
{
struct pt_gpio_chip *pt_gpio = platform_get_drvdata(pdev);

gpiochip_remove(&pt_gpio->gc);
-
- return 0;
}

static const struct acpi_device_id pt_gpio_acpi_match[] = {
@@ -145,7 +143,7 @@ static struct platform_driver pt_gpio_driver = {
.acpi_match_table = ACPI_PTR(pt_gpio_acpi_match),
},
.probe = pt_gpio_probe,
- .remove = pt_gpio_remove,
+ .remove_new = pt_gpio_remove,
};

module_platform_driver(pt_gpio_driver);
--
2.40.1

2023-09-28 07:21:33

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 07/23] gpio: grgpio: 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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/gpio/gpio-grgpio.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-grgpio.c b/drivers/gpio/gpio-grgpio.c
index 0163c95f6dd7..017c7170eb57 100644
--- a/drivers/gpio/gpio-grgpio.c
+++ b/drivers/gpio/gpio-grgpio.c
@@ -431,7 +431,7 @@ static int grgpio_probe(struct platform_device *ofdev)
return 0;
}

-static int grgpio_remove(struct platform_device *ofdev)
+static void grgpio_remove(struct platform_device *ofdev)
{
struct grgpio_priv *priv = platform_get_drvdata(ofdev);

@@ -439,8 +439,6 @@ static int grgpio_remove(struct platform_device *ofdev)

if (priv->domain)
irq_domain_remove(priv->domain);
-
- return 0;
}

static const struct of_device_id grgpio_match[] = {
@@ -457,7 +455,7 @@ static struct platform_driver grgpio_driver = {
.of_match_table = grgpio_match,
},
.probe = grgpio_probe,
- .remove = grgpio_remove,
+ .remove_new = grgpio_remove,
};
module_platform_driver(grgpio_driver);

--
2.40.1

2023-09-28 07:21:45

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 14/23] gpio: omap: 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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/gpio/gpio-omap.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index a927680c66f8..8889755e2d03 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1489,7 +1489,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
return 0;
}

-static int omap_gpio_remove(struct platform_device *pdev)
+static void omap_gpio_remove(struct platform_device *pdev)
{
struct gpio_bank *bank = platform_get_drvdata(pdev);

@@ -1498,8 +1498,6 @@ static int omap_gpio_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
if (bank->dbck_flag)
clk_unprepare(bank->dbck);
-
- return 0;
}

static int __maybe_unused omap_gpio_runtime_suspend(struct device *dev)
@@ -1560,7 +1558,7 @@ static const struct dev_pm_ops gpio_pm_ops = {

static struct platform_driver omap_gpio_driver = {
.probe = omap_gpio_probe,
- .remove = omap_gpio_remove,
+ .remove_new = omap_gpio_remove,
.driver = {
.name = "omap_gpio",
.pm = &gpio_pm_ops,
--
2.40.1

2023-09-28 07:21:50

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 06/23] gpio: ftgpio010: 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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/gpio/gpio-ftgpio010.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-ftgpio010.c b/drivers/gpio/gpio-ftgpio010.c
index 5ce59dcf02e3..97d345b59352 100644
--- a/drivers/gpio/gpio-ftgpio010.c
+++ b/drivers/gpio/gpio-ftgpio010.c
@@ -324,13 +324,11 @@ static int ftgpio_gpio_probe(struct platform_device *pdev)
return ret;
}

-static int ftgpio_gpio_remove(struct platform_device *pdev)
+static void ftgpio_gpio_remove(struct platform_device *pdev)
{
struct ftgpio_gpio *g = platform_get_drvdata(pdev);

clk_disable_unprepare(g->clk);
-
- return 0;
}

static const struct of_device_id ftgpio_gpio_of_match[] = {
@@ -352,6 +350,6 @@ static struct platform_driver ftgpio_gpio_driver = {
.of_match_table = ftgpio_gpio_of_match,
},
.probe = ftgpio_gpio_probe,
- .remove = ftgpio_gpio_remove,
+ .remove_new = ftgpio_gpio_remove,
};
builtin_platform_driver(ftgpio_gpio_driver);
--
2.40.1

2023-09-28 07:22:04

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 01/23] gpio: altera: 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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/gpio/gpio-altera.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-altera.c b/drivers/gpio/gpio-altera.c
index 54d7c450c596..c2edfbb231fc 100644
--- a/drivers/gpio/gpio-altera.c
+++ b/drivers/gpio/gpio-altera.c
@@ -317,13 +317,11 @@ static int altera_gpio_probe(struct platform_device *pdev)
return 0;
}

-static int altera_gpio_remove(struct platform_device *pdev)
+static void altera_gpio_remove(struct platform_device *pdev)
{
struct altera_gpio_chip *altera_gc = platform_get_drvdata(pdev);

of_mm_gpiochip_remove(&altera_gc->mmchip);
-
- return 0;
}

static const struct of_device_id altera_gpio_of_match[] = {
@@ -338,7 +336,7 @@ static struct platform_driver altera_gpio_driver = {
.of_match_table = altera_gpio_of_match,
},
.probe = altera_gpio_probe,
- .remove = altera_gpio_remove,
+ .remove_new = altera_gpio_remove,
};

static int __init altera_gpio_init(void)
--
2.40.1

2023-09-28 07:22:15

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 19/23] gpio: uniphier: 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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/gpio/gpio-uniphier.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-uniphier.c b/drivers/gpio/gpio-uniphier.c
index 9725b7aa18a7..1f440707f8f4 100644
--- a/drivers/gpio/gpio-uniphier.c
+++ b/drivers/gpio/gpio-uniphier.c
@@ -414,13 +414,11 @@ static int uniphier_gpio_probe(struct platform_device *pdev)
return 0;
}

-static int uniphier_gpio_remove(struct platform_device *pdev)
+static void uniphier_gpio_remove(struct platform_device *pdev)
{
struct uniphier_gpio_priv *priv = platform_get_drvdata(pdev);

irq_domain_remove(priv->domain);
-
- return 0;
}

static int __maybe_unused uniphier_gpio_suspend(struct device *dev)
@@ -482,7 +480,7 @@ MODULE_DEVICE_TABLE(of, uniphier_gpio_match);

static struct platform_driver uniphier_gpio_driver = {
.probe = uniphier_gpio_probe,
- .remove = uniphier_gpio_remove,
+ .remove_new = uniphier_gpio_remove,
.driver = {
.name = "uniphier-gpio",
.of_match_table = uniphier_gpio_match,
--
2.40.1

2023-09-28 07:22:15

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 20/23] gpio: xgene-sb: 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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/gpio/gpio-xgene-sb.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-xgene-sb.c b/drivers/gpio/gpio-xgene-sb.c
index 453bf9338ac4..bd5befa807c3 100644
--- a/drivers/gpio/gpio-xgene-sb.c
+++ b/drivers/gpio/gpio-xgene-sb.c
@@ -295,15 +295,13 @@ static int xgene_gpio_sb_probe(struct platform_device *pdev)
return ret;
}

-static int xgene_gpio_sb_remove(struct platform_device *pdev)
+static void xgene_gpio_sb_remove(struct platform_device *pdev)
{
struct xgene_gpio_sb *priv = platform_get_drvdata(pdev);

acpi_gpiochip_free_interrupts(&priv->gc);

irq_domain_remove(priv->irq_domain);
-
- return 0;
}

static const struct of_device_id xgene_gpio_sb_of_match[] = {
@@ -327,7 +325,7 @@ static struct platform_driver xgene_gpio_sb_driver = {
.acpi_match_table = ACPI_PTR(xgene_gpio_sb_acpi_match),
},
.probe = xgene_gpio_sb_probe,
- .remove = xgene_gpio_sb_remove,
+ .remove_new = xgene_gpio_sb_remove,
};
module_platform_driver(xgene_gpio_sb_driver);

--
2.40.1

2023-09-28 07:29:14

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 03/23] gpio: brcmstb: 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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/gpio/gpio-brcmstb.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c
index bccdbfd5ec80..a789af4a5c85 100644
--- a/drivers/gpio/gpio-brcmstb.c
+++ b/drivers/gpio/gpio-brcmstb.c
@@ -371,7 +371,7 @@ static int brcmstb_gpio_sanity_check_banks(struct device *dev,
}
}

-static int brcmstb_gpio_remove(struct platform_device *pdev)
+static void brcmstb_gpio_remove(struct platform_device *pdev)
{
struct brcmstb_gpio_priv *priv = platform_get_drvdata(pdev);
struct brcmstb_gpio_bank *bank;
@@ -395,8 +395,6 @@ static int brcmstb_gpio_remove(struct platform_device *pdev)
*/
list_for_each_entry(bank, &priv->bank_list, node)
gpiochip_remove(&bank->gc);
-
- return 0;
}

static int brcmstb_gpio_of_xlate(struct gpio_chip *gc,
@@ -757,7 +755,7 @@ static struct platform_driver brcmstb_gpio_driver = {
.pm = &brcmstb_gpio_pm_ops,
},
.probe = brcmstb_gpio_probe,
- .remove = brcmstb_gpio_remove,
+ .remove_new = brcmstb_gpio_remove,
.shutdown = brcmstb_gpio_shutdown,
};
module_platform_driver(brcmstb_gpio_driver);
--
2.40.1

2023-09-28 07:29:47

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 18/23] gpio: ts5500: 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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/gpio/gpio-ts5500.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-ts5500.c b/drivers/gpio/gpio-ts5500.c
index 8e03614c7a24..90f8e9e9915e 100644
--- a/drivers/gpio/gpio-ts5500.c
+++ b/drivers/gpio/gpio-ts5500.c
@@ -412,13 +412,11 @@ static int ts5500_dio_probe(struct platform_device *pdev)
return 0;
}

-static int ts5500_dio_remove(struct platform_device *pdev)
+static void ts5500_dio_remove(struct platform_device *pdev)
{
struct ts5500_priv *priv = platform_get_drvdata(pdev);

ts5500_disable_irq(priv);
-
- return 0;
}

static const struct platform_device_id ts5500_dio_ids[] = {
@@ -435,7 +433,7 @@ static struct platform_driver ts5500_dio_driver = {
.name = "ts5500-dio",
},
.probe = ts5500_dio_probe,
- .remove = ts5500_dio_remove,
+ .remove_new = ts5500_dio_remove,
.id_table = ts5500_dio_ids,
};

--
2.40.1

2023-09-28 07:41:27

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 15/23] gpio: rcar: 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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/gpio/gpio-rcar.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 86e69cde04da..d8b1baae6357 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -583,14 +583,13 @@ static int gpio_rcar_probe(struct platform_device *pdev)
return ret;
}

-static int gpio_rcar_remove(struct platform_device *pdev)
+static void gpio_rcar_remove(struct platform_device *pdev)
{
struct gpio_rcar_priv *p = platform_get_drvdata(pdev);

gpiochip_remove(&p->gpio_chip);

pm_runtime_disable(&pdev->dev);
- return 0;
}

#ifdef CONFIG_PM_SLEEP
@@ -658,7 +657,7 @@ static SIMPLE_DEV_PM_OPS(gpio_rcar_pm_ops, gpio_rcar_suspend, gpio_rcar_resume);

static struct platform_driver gpio_rcar_device_driver = {
.probe = gpio_rcar_probe,
- .remove = gpio_rcar_remove,
+ .remove_new = gpio_rcar_remove,
.driver = {
.name = "gpio_rcar",
.pm = &gpio_rcar_pm_ops,
--
2.40.1

2023-09-28 07:42:45

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 13/23] gpio: mpc8xxx: 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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/gpio/gpio-mpc8xxx.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index ebf2f511df59..c0125ac73906 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -419,7 +419,7 @@ static int mpc8xxx_probe(struct platform_device *pdev)
return ret;
}

-static int mpc8xxx_remove(struct platform_device *pdev)
+static void mpc8xxx_remove(struct platform_device *pdev)
{
struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev);

@@ -427,8 +427,6 @@ static int mpc8xxx_remove(struct platform_device *pdev)
irq_set_chained_handler_and_data(mpc8xxx_gc->irqn, NULL, NULL);
irq_domain_remove(mpc8xxx_gc->irq);
}
-
- return 0;
}

#ifdef CONFIG_ACPI
@@ -441,7 +439,7 @@ MODULE_DEVICE_TABLE(acpi, gpio_acpi_ids);

static struct platform_driver mpc8xxx_plat_driver = {
.probe = mpc8xxx_probe,
- .remove = mpc8xxx_remove,
+ .remove_new = mpc8xxx_remove,
.driver = {
.name = "gpio-mpc8xxx",
.of_match_table = mpc8xxx_gpio_ids,
--
2.40.1

2023-09-28 07:43:43

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 22/23] gpio: xilinx: 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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/gpio/gpio-xilinx.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c
index a16945e8319e..823198368250 100644
--- a/drivers/gpio/gpio-xilinx.c
+++ b/drivers/gpio/gpio-xilinx.c
@@ -332,7 +332,7 @@ static int __maybe_unused xgpio_suspend(struct device *dev)
*
* Return: 0 always
*/
-static int xgpio_remove(struct platform_device *pdev)
+static void xgpio_remove(struct platform_device *pdev)
{
struct xgpio_instance *gpio = platform_get_drvdata(pdev);

@@ -340,8 +340,6 @@ static int xgpio_remove(struct platform_device *pdev)
pm_runtime_put_noidle(&pdev->dev);
pm_runtime_disable(&pdev->dev);
clk_disable_unprepare(gpio->clk);
-
- return 0;
}

/**
@@ -715,7 +713,7 @@ MODULE_DEVICE_TABLE(of, xgpio_of_match);

static struct platform_driver xgpio_plat_driver = {
.probe = xgpio_probe,
- .remove = xgpio_remove,
+ .remove_new = xgpio_remove,
.driver = {
.name = "gpio-xilinx",
.of_match_table = xgpio_of_match,
--
2.40.1

2023-09-28 11:53:57

by Datta, Shubhrajyoti

[permalink] [raw]
Subject: RE: [PATCH 22/23] gpio: xilinx: Convert to platform remove callback returning void

[AMD Official Use Only - General]

Hi ,
Thanks for the patch

> -----Original Message-----
> From: Uwe Kleine-König <[email protected]>
> Sent: Thursday, September 28, 2023 12:37 PM
> To: Linus Walleij <[email protected]>; Bartosz Golaszewski
> <[email protected]>
> Cc: Datta, Shubhrajyoti <[email protected]>; Neeli, Srinivas
> <[email protected]>; Simek, Michal <[email protected]>; Andy
> Shevchenko <[email protected]>; [email protected]; linux-arm-
> [email protected]; [email protected]
> Subject: [PATCH 22/23] gpio: xilinx: Convert to platform remove callback
> returning void
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> 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 <[email protected]>
Reviewed-by: Shubhrajyoti Datta <[email protected]>

2023-09-29 02:06:26

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH 03/23] gpio: brcmstb: Convert to platform remove callback returning void



On 9/28/2023 9:06 AM, 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 <[email protected]>

Reviewed-by: Florian Fainelli <[email protected]>
--
Florian


Attachments:
smime.p7s (4.12 kB)
S/MIME Cryptographic Signature

2023-09-29 16:44:58

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 00/23] gpio: Convert to platform remove callback returning void

On Thu, Sep 28, 2023 at 9:07 AM Uwe Kleine-König
<[email protected]> wrote:

> this series converts all platform drivers below drivers/gpio to use
> .remove_new(). The motivation is to get rid of an integer return code
> that is (mostly) ignored by the platform driver core and error prone on
> the driver side.

The whole set looks good to me:
Reviewed-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2023-10-02 13:15:03

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH 00/23] gpio: Convert to platform remove callback returning void

On Thu, Sep 28, 2023 at 9:07 AM Uwe Kleine-König
<[email protected]> wrote:
>
> Hello,
>
> this series converts all platform drivers below drivers/gpio to use
> .remove_new(). The motivation is to get rid of an integer return code
> that is (mostly) ignored by the platform driver core and error prone on
> the driver side.
>
> See commit 5c5a7680e67b ("platform: Provide a remove callback that
> returns no value") for an extended explanation and the eventual goal.
>
> There are no interdependencies between the patches. 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 subject prefix is suboptimal, please apply the remainder of
> this series anyhow.
>
> Best regards
> Uwe
>
> Uwe Kleine-König (23):
> gpio: altera: Convert to platform remove callback returning void
> gpio: amdpt: Convert to platform remove callback returning void
> gpio: brcmstb: Convert to platform remove callback returning void
> gpio: cadence: Convert to platform remove callback returning void
> gpio: dln2: Convert to platform remove callback returning void
> gpio: ftgpio010: Convert to platform remove callback returning void
> gpio: grgpio: Convert to platform remove callback returning void
> gpio: ljca: Convert to platform remove callback returning void
> gpio: lpc18xx: Convert to platform remove callback returning void
> gpio: mb86s7x: Convert to platform remove callback returning void
> gpio: mm-lantiq: Convert to platform remove callback returning void
> gpio: mpc5200: Convert to platform remove callback returning void
> gpio: mpc8xxx: Convert to platform remove callback returning void
> gpio: omap: Convert to platform remove callback returning void
> gpio: rcar: Convert to platform remove callback returning void
> gpio: rockchip: Convert to platform remove callback returning void
> gpio: tb10x: Convert to platform remove callback returning void
> gpio: ts5500: Convert to platform remove callback returning void
> gpio: uniphier: Convert to platform remove callback returning void
> gpio: xgene-sb: Convert to platform remove callback returning void
> gpio: xgs-iproc: Convert to platform remove callback returning void
> gpio: xilinx: Convert to platform remove callback returning void
> gpio: zynq: Convert to platform remove callback returning void
>
> drivers/gpio/gpio-altera.c | 6 ++----
> drivers/gpio/gpio-amdpt.c | 6 ++----
> drivers/gpio/gpio-brcmstb.c | 6 ++----
> drivers/gpio/gpio-cadence.c | 6 ++----
> drivers/gpio/gpio-dln2.c | 6 ++----
> drivers/gpio/gpio-ftgpio010.c | 6 ++----
> drivers/gpio/gpio-grgpio.c | 6 ++----
> drivers/gpio/gpio-ljca.c | 5 ++---
> drivers/gpio/gpio-lpc18xx.c | 6 ++----
> drivers/gpio/gpio-mb86s7x.c | 6 ++----
> drivers/gpio/gpio-mm-lantiq.c | 6 ++----
> drivers/gpio/gpio-mpc5200.c | 8 +++-----
> drivers/gpio/gpio-mpc8xxx.c | 6 ++----
> drivers/gpio/gpio-omap.c | 6 ++----
> drivers/gpio/gpio-rcar.c | 5 ++---
> drivers/gpio/gpio-rockchip.c | 6 ++----
> drivers/gpio/gpio-tb10x.c | 6 ++----
> drivers/gpio/gpio-ts5500.c | 6 ++----
> drivers/gpio/gpio-uniphier.c | 6 ++----
> drivers/gpio/gpio-xgene-sb.c | 6 ++----
> drivers/gpio/gpio-xgs-iproc.c | 6 ++----
> drivers/gpio/gpio-xilinx.c | 6 ++----
> drivers/gpio/gpio-zynq.c | 5 ++---
> 23 files changed, 47 insertions(+), 90 deletions(-)
>
>
> base-commit: 719136e5c24768ebdf80b9daa53facebbdd377c3
> --
> 2.40.1
>

Series queued for v6.7, thanks!

Bart