* [PATCH 02/49] iio: adc: ab8500-gpadc: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
@ 2023-09-19 17:48 ` Uwe Kleine-König
2023-09-19 17:48 ` [PATCH 03/49] iio: adc: at91-sama5d2: " Uwe Kleine-König
` (18 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:48 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Linus Walleij, Lars-Peter Clausen, linux-arm-kernel, linux-iio,
kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/adc/ab8500-gpadc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c
index 3b1bdd0b531d..80645fee79a4 100644
--- a/drivers/iio/adc/ab8500-gpadc.c
+++ b/drivers/iio/adc/ab8500-gpadc.c
@@ -1179,7 +1179,7 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
return ret;
}
-static int ab8500_gpadc_remove(struct platform_device *pdev)
+static void ab8500_gpadc_remove(struct platform_device *pdev)
{
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct ab8500_gpadc *gpadc = iio_priv(indio_dev);
@@ -1188,8 +1188,6 @@ static int ab8500_gpadc_remove(struct platform_device *pdev)
pm_runtime_put_noidle(gpadc->dev);
pm_runtime_disable(gpadc->dev);
regulator_disable(gpadc->vddadc);
-
- return 0;
}
static DEFINE_RUNTIME_DEV_PM_OPS(ab8500_gpadc_pm_ops,
@@ -1198,7 +1196,7 @@ static DEFINE_RUNTIME_DEV_PM_OPS(ab8500_gpadc_pm_ops,
static struct platform_driver ab8500_gpadc_driver = {
.probe = ab8500_gpadc_probe,
- .remove = ab8500_gpadc_remove,
+ .remove_new = ab8500_gpadc_remove,
.driver = {
.name = "ab8500-gpadc",
.pm = pm_ptr(&ab8500_gpadc_pm_ops),
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 03/49] iio: adc: at91-sama5d2: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
2023-09-19 17:48 ` [PATCH 02/49] iio: adc: ab8500-gpadc: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-09-19 17:48 ` Uwe Kleine-König
2023-09-19 17:48 ` [PATCH 04/49] iio: adc: at91: " Uwe Kleine-König
` (17 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:48 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Alexandre Belloni, Lars-Peter Clausen, linux-iio, Eugen Hristev,
Claudiu Beznea, kernel, linux-arm-kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/adc/at91-sama5d2_adc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index df67b63ccf69..d7fd21e7c6e2 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -2486,7 +2486,7 @@ static int at91_adc_probe(struct platform_device *pdev)
return ret;
}
-static int at91_adc_remove(struct platform_device *pdev)
+static void at91_adc_remove(struct platform_device *pdev)
{
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct at91_adc_state *st = iio_priv(indio_dev);
@@ -2501,8 +2501,6 @@ static int at91_adc_remove(struct platform_device *pdev)
regulator_disable(st->vref);
regulator_disable(st->reg);
-
- return 0;
}
static int at91_adc_suspend(struct device *dev)
@@ -2627,7 +2625,7 @@ MODULE_DEVICE_TABLE(of, at91_adc_dt_match);
static struct platform_driver at91_adc_driver = {
.probe = at91_adc_probe,
- .remove = at91_adc_remove,
+ .remove_new = at91_adc_remove,
.driver = {
.name = "at91-sama5d2_adc",
.of_match_table = at91_adc_dt_match,
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 04/49] iio: adc: at91: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
2023-09-19 17:48 ` [PATCH 02/49] iio: adc: ab8500-gpadc: Convert to platform remove callback returning void Uwe Kleine-König
2023-09-19 17:48 ` [PATCH 03/49] iio: adc: at91-sama5d2: " Uwe Kleine-König
@ 2023-09-19 17:48 ` Uwe Kleine-König
2023-09-19 17:48 ` [PATCH 06/49] iio: adc: bcm_iproc: " Uwe Kleine-König
` (16 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:48 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Rob Herring, Alexandre Belloni, Lars-Peter Clausen,
Heiko Stuebner, linux-iio, Jinjie Ruan, Claudiu Beznea, kernel,
Yang Yingliang, linux-arm-kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/adc/at91_adc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 200c4599530b..eb501e3c86a5 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -1185,7 +1185,7 @@ static int at91_adc_probe(struct platform_device *pdev)
return ret;
}
-static int at91_adc_remove(struct platform_device *pdev)
+static void at91_adc_remove(struct platform_device *pdev)
{
struct iio_dev *idev = platform_get_drvdata(pdev);
struct at91_adc_state *st = iio_priv(idev);
@@ -1197,8 +1197,6 @@ static int at91_adc_remove(struct platform_device *pdev)
} else {
at91_ts_unregister(st);
}
-
- return 0;
}
static int at91_adc_suspend(struct device *dev)
@@ -1348,7 +1346,7 @@ MODULE_DEVICE_TABLE(of, at91_adc_dt_ids);
static struct platform_driver at91_adc_driver = {
.probe = at91_adc_probe,
- .remove = at91_adc_remove,
+ .remove_new = at91_adc_remove,
.driver = {
.name = DRIVER_NAME,
.of_match_table = at91_adc_dt_ids,
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 06/49] iio: adc: bcm_iproc: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (2 preceding siblings ...)
2023-09-19 17:48 ` [PATCH 04/49] iio: adc: at91: " Uwe Kleine-König
@ 2023-09-19 17:48 ` Uwe Kleine-König
2023-09-19 18:54 ` Florian Fainelli
2023-09-19 17:48 ` [PATCH 08/49] iio: adc: ep93xx: " Uwe Kleine-König
` (15 subsequent siblings)
19 siblings, 1 reply; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:48 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Ruan Jinjie, linux-iio,
linux-arm-kernel, kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/adc/bcm_iproc_adc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
index 0d6885413a7e..5bc514bd5ebc 100644
--- a/drivers/iio/adc/bcm_iproc_adc.c
+++ b/drivers/iio/adc/bcm_iproc_adc.c
@@ -594,7 +594,7 @@ static int iproc_adc_probe(struct platform_device *pdev)
return ret;
}
-static int iproc_adc_remove(struct platform_device *pdev)
+static void iproc_adc_remove(struct platform_device *pdev)
{
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct iproc_adc_priv *adc_priv = iio_priv(indio_dev);
@@ -602,8 +602,6 @@ static int iproc_adc_remove(struct platform_device *pdev)
iio_device_unregister(indio_dev);
iproc_adc_disable(indio_dev);
clk_disable_unprepare(adc_priv->adc_clk);
-
- return 0;
}
static const struct of_device_id iproc_adc_of_match[] = {
@@ -614,7 +612,7 @@ MODULE_DEVICE_TABLE(of, iproc_adc_of_match);
static struct platform_driver iproc_adc_driver = {
.probe = iproc_adc_probe,
- .remove = iproc_adc_remove,
+ .remove_new = iproc_adc_remove,
.driver = {
.name = "iproc-static-adc",
.of_match_table = iproc_adc_of_match,
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH 06/49] iio: adc: bcm_iproc: Convert to platform remove callback returning void
2023-09-19 17:48 ` [PATCH 06/49] iio: adc: bcm_iproc: " Uwe Kleine-König
@ 2023-09-19 18:54 ` Florian Fainelli
0 siblings, 0 replies; 23+ messages in thread
From: Florian Fainelli @ 2023-09-19 18:54 UTC (permalink / raw)
To: Uwe Kleine-König, Jonathan Cameron
Cc: Lars-Peter Clausen, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Ruan Jinjie, linux-iio,
linux-arm-kernel, kernel
[-- Attachment #1.1: Type: text/plain, Size: 875 bytes --]
On 9/19/23 10:48, 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>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 08/49] iio: adc: ep93xx: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (3 preceding siblings ...)
2023-09-19 17:48 ` [PATCH 06/49] iio: adc: bcm_iproc: " Uwe Kleine-König
@ 2023-09-19 17:48 ` Uwe Kleine-König
2023-09-19 17:54 ` Alexander Sverdlin
2023-09-19 17:48 ` [PATCH 09/49] iio: adc: exynos: " Uwe Kleine-König
` (14 subsequent siblings)
19 siblings, 1 reply; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:48 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Hartley Sweeten, Alexander Sverdlin, Lars-Peter Clausen,
linux-arm-kernel, linux-iio, kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/adc/ep93xx_adc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/ep93xx_adc.c b/drivers/iio/adc/ep93xx_adc.c
index a35e6cead67d..971942ce4c66 100644
--- a/drivers/iio/adc/ep93xx_adc.c
+++ b/drivers/iio/adc/ep93xx_adc.c
@@ -217,15 +217,13 @@ static int ep93xx_adc_probe(struct platform_device *pdev)
return ret;
}
-static int ep93xx_adc_remove(struct platform_device *pdev)
+static void ep93xx_adc_remove(struct platform_device *pdev)
{
struct iio_dev *iiodev = platform_get_drvdata(pdev);
struct ep93xx_adc_priv *priv = iio_priv(iiodev);
iio_device_unregister(iiodev);
clk_disable_unprepare(priv->clk);
-
- return 0;
}
static const struct of_device_id ep93xx_adc_of_ids[] = {
@@ -240,7 +238,7 @@ static struct platform_driver ep93xx_adc_driver = {
.of_match_table = ep93xx_adc_of_ids,
},
.probe = ep93xx_adc_probe,
- .remove = ep93xx_adc_remove,
+ .remove_new = ep93xx_adc_remove,
};
module_platform_driver(ep93xx_adc_driver);
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH 08/49] iio: adc: ep93xx: Convert to platform remove callback returning void
2023-09-19 17:48 ` [PATCH 08/49] iio: adc: ep93xx: " Uwe Kleine-König
@ 2023-09-19 17:54 ` Alexander Sverdlin
0 siblings, 0 replies; 23+ messages in thread
From: Alexander Sverdlin @ 2023-09-19 17:54 UTC (permalink / raw)
To: Uwe Kleine-König, Jonathan Cameron
Cc: Hartley Sweeten, Lars-Peter Clausen, linux-arm-kernel, linux-iio,
kernel
Hi Uwe,
On Tue, 2023-09-19 at 19:48 +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>
> ---
> drivers/iio/adc/ep93xx_adc.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
--
Alexander Sverdlin.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 09/49] iio: adc: exynos: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (4 preceding siblings ...)
2023-09-19 17:48 ` [PATCH 08/49] iio: adc: ep93xx: " Uwe Kleine-König
@ 2023-09-19 17:48 ` Uwe Kleine-König
2023-09-19 17:48 ` [PATCH 10/49] iio: adc: fsl-imx25-gcq: " Uwe Kleine-König
` (13 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:48 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Krzysztof Kozlowski, Alim Akhtar, linux-iio,
linux-arm-kernel, linux-samsung-soc, kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/adc/exynos_adc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
index cff1ba57fb16..eb7a2dd59517 100644
--- a/drivers/iio/adc/exynos_adc.c
+++ b/drivers/iio/adc/exynos_adc.c
@@ -946,7 +946,7 @@ static int exynos_adc_probe(struct platform_device *pdev)
return ret;
}
-static int exynos_adc_remove(struct platform_device *pdev)
+static void exynos_adc_remove(struct platform_device *pdev)
{
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct exynos_adc *info = iio_priv(indio_dev);
@@ -964,8 +964,6 @@ static int exynos_adc_remove(struct platform_device *pdev)
exynos_adc_disable_clk(info);
exynos_adc_unprepare_clk(info);
regulator_disable(info->vdd);
-
- return 0;
}
static int exynos_adc_suspend(struct device *dev)
@@ -1006,7 +1004,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(exynos_adc_pm_ops, exynos_adc_suspend,
static struct platform_driver exynos_adc_driver = {
.probe = exynos_adc_probe,
- .remove = exynos_adc_remove,
+ .remove_new = exynos_adc_remove,
.driver = {
.name = "exynos-adc",
.of_match_table = exynos_adc_match,
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 10/49] iio: adc: fsl-imx25-gcq: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (5 preceding siblings ...)
2023-09-19 17:48 ` [PATCH 09/49] iio: adc: exynos: " Uwe Kleine-König
@ 2023-09-19 17:48 ` Uwe Kleine-König
2023-09-19 17:48 ` [PATCH 12/49] iio: adc: imx8qxp: " Uwe Kleine-König
` (12 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:48 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Shawn Guo, Sascha Hauer, Fabio Estevam,
NXP Linux Team, linux-iio, linux-arm-kernel, kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/adc/fsl-imx25-gcq.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/fsl-imx25-gcq.c b/drivers/iio/adc/fsl-imx25-gcq.c
index 551e83ae573c..68c813de0605 100644
--- a/drivers/iio/adc/fsl-imx25-gcq.c
+++ b/drivers/iio/adc/fsl-imx25-gcq.c
@@ -384,7 +384,7 @@ static int mx25_gcq_probe(struct platform_device *pdev)
return ret;
}
-static int mx25_gcq_remove(struct platform_device *pdev)
+static void mx25_gcq_remove(struct platform_device *pdev)
{
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct mx25_gcq_priv *priv = iio_priv(indio_dev);
@@ -397,8 +397,6 @@ static int mx25_gcq_remove(struct platform_device *pdev)
if (priv->vref[i])
regulator_disable(priv->vref[i]);
}
-
- return 0;
}
static const struct of_device_id mx25_gcq_ids[] = {
@@ -413,7 +411,7 @@ static struct platform_driver mx25_gcq_driver = {
.of_match_table = mx25_gcq_ids,
},
.probe = mx25_gcq_probe,
- .remove = mx25_gcq_remove,
+ .remove_new = mx25_gcq_remove,
};
module_platform_driver(mx25_gcq_driver);
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 12/49] iio: adc: imx8qxp: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (6 preceding siblings ...)
2023-09-19 17:48 ` [PATCH 10/49] iio: adc: fsl-imx25-gcq: " Uwe Kleine-König
@ 2023-09-19 17:48 ` Uwe Kleine-König
2023-09-19 17:48 ` [PATCH 13/49] iio: adc: imx93: " Uwe Kleine-König
` (11 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:48 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Cai Huoqing, Haibo Chen, Lars-Peter Clausen, Shawn Guo,
Sascha Hauer, Fabio Estevam, NXP Linux Team, linux-iio,
linux-arm-kernel, kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/adc/imx8qxp-adc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/imx8qxp-adc.c b/drivers/iio/adc/imx8qxp-adc.c
index fff6e5a2d956..fe82198170d5 100644
--- a/drivers/iio/adc/imx8qxp-adc.c
+++ b/drivers/iio/adc/imx8qxp-adc.c
@@ -404,7 +404,7 @@ static int imx8qxp_adc_probe(struct platform_device *pdev)
return ret;
}
-static int imx8qxp_adc_remove(struct platform_device *pdev)
+static void imx8qxp_adc_remove(struct platform_device *pdev)
{
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct imx8qxp_adc *adc = iio_priv(indio_dev);
@@ -422,8 +422,6 @@ static int imx8qxp_adc_remove(struct platform_device *pdev)
pm_runtime_disable(dev);
pm_runtime_put_noidle(dev);
-
- return 0;
}
static int imx8qxp_adc_runtime_suspend(struct device *dev)
@@ -489,7 +487,7 @@ MODULE_DEVICE_TABLE(of, imx8qxp_adc_match);
static struct platform_driver imx8qxp_adc_driver = {
.probe = imx8qxp_adc_probe,
- .remove = imx8qxp_adc_remove,
+ .remove_new = imx8qxp_adc_remove,
.driver = {
.name = ADC_DRIVER_NAME,
.of_match_table = imx8qxp_adc_match,
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 13/49] iio: adc: imx93: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (7 preceding siblings ...)
2023-09-19 17:48 ` [PATCH 12/49] iio: adc: imx8qxp: " Uwe Kleine-König
@ 2023-09-19 17:48 ` Uwe Kleine-König
2023-09-19 17:48 ` [PATCH 14/49] iio: adc: meson_saradc: " Uwe Kleine-König
` (10 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:48 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Haibo Chen, Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
Fabio Estevam, NXP Linux Team, linux-iio, linux-arm-kernel,
kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/adc/imx93_adc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/imx93_adc.c b/drivers/iio/adc/imx93_adc.c
index dce9ec91e4a7..9bb1e4ba1aee 100644
--- a/drivers/iio/adc/imx93_adc.c
+++ b/drivers/iio/adc/imx93_adc.c
@@ -392,7 +392,7 @@ static int imx93_adc_probe(struct platform_device *pdev)
return ret;
}
-static int imx93_adc_remove(struct platform_device *pdev)
+static void imx93_adc_remove(struct platform_device *pdev)
{
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct imx93_adc *adc = iio_priv(indio_dev);
@@ -410,8 +410,6 @@ static int imx93_adc_remove(struct platform_device *pdev)
free_irq(adc->irq, adc);
clk_disable_unprepare(adc->ipg_clk);
regulator_disable(adc->vref);
-
- return 0;
}
static int imx93_adc_runtime_suspend(struct device *dev)
@@ -468,7 +466,7 @@ MODULE_DEVICE_TABLE(of, imx93_adc_match);
static struct platform_driver imx93_adc_driver = {
.probe = imx93_adc_probe,
- .remove = imx93_adc_remove,
+ .remove_new = imx93_adc_remove,
.driver = {
.name = IMX93_ADC_DRIVER_NAME,
.of_match_table = imx93_adc_match,
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 14/49] iio: adc: meson_saradc: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (8 preceding siblings ...)
2023-09-19 17:48 ` [PATCH 13/49] iio: adc: imx93: " Uwe Kleine-König
@ 2023-09-19 17:48 ` Uwe Kleine-König
2023-09-19 17:48 ` [PATCH 16/49] iio: adc: mxs-lradc: " Uwe Kleine-König
` (9 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:48 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, George Stark, Andy Shevchenko, Nuno Sá,
Rob Herring, linux-iio, linux-arm-kernel, linux-amlogic, kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/adc/meson_saradc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index 320e3e7e3d4d..a40986fb285c 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -1437,15 +1437,13 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
return ret;
}
-static int meson_sar_adc_remove(struct platform_device *pdev)
+static void meson_sar_adc_remove(struct platform_device *pdev)
{
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
iio_device_unregister(indio_dev);
meson_sar_adc_hw_disable(indio_dev);
-
- return 0;
}
static int meson_sar_adc_suspend(struct device *dev)
@@ -1480,7 +1478,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(meson_sar_adc_pm_ops,
static struct platform_driver meson_sar_adc_driver = {
.probe = meson_sar_adc_probe,
- .remove = meson_sar_adc_remove,
+ .remove_new = meson_sar_adc_remove,
.driver = {
.name = "meson-saradc",
.of_match_table = meson_sar_adc_of_match,
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 16/49] iio: adc: mxs-lradc: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (9 preceding siblings ...)
2023-09-19 17:48 ` [PATCH 14/49] iio: adc: meson_saradc: " Uwe Kleine-König
@ 2023-09-19 17:48 ` Uwe Kleine-König
2023-09-19 17:49 ` [PATCH 20/49] iio: adc: stm32-adc-core: " Uwe Kleine-König
` (8 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:48 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Shawn Guo, Sascha Hauer, Fabio Estevam,
NXP Linux Team, Jiakai Luo, Dongliang Mu, linux-iio,
linux-arm-kernel, kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/adc/mxs-lradc-adc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c
index a50f39143d3e..2e60c10ee4ff 100644
--- a/drivers/iio/adc/mxs-lradc-adc.c
+++ b/drivers/iio/adc/mxs-lradc-adc.c
@@ -807,7 +807,7 @@ static int mxs_lradc_adc_probe(struct platform_device *pdev)
return ret;
}
-static int mxs_lradc_adc_remove(struct platform_device *pdev)
+static void mxs_lradc_adc_remove(struct platform_device *pdev)
{
struct iio_dev *iio = platform_get_drvdata(pdev);
struct mxs_lradc_adc *adc = iio_priv(iio);
@@ -816,8 +816,6 @@ static int mxs_lradc_adc_remove(struct platform_device *pdev)
mxs_lradc_adc_hw_stop(adc);
iio_triggered_buffer_cleanup(iio);
mxs_lradc_adc_trigger_remove(iio);
-
- return 0;
}
static struct platform_driver mxs_lradc_adc_driver = {
@@ -825,7 +823,7 @@ static struct platform_driver mxs_lradc_adc_driver = {
.name = "mxs-lradc-adc",
},
.probe = mxs_lradc_adc_probe,
- .remove = mxs_lradc_adc_remove,
+ .remove_new = mxs_lradc_adc_remove,
};
module_platform_driver(mxs_lradc_adc_driver);
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 20/49] iio: adc: stm32-adc-core: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (10 preceding siblings ...)
2023-09-19 17:48 ` [PATCH 16/49] iio: adc: mxs-lradc: " Uwe Kleine-König
@ 2023-09-19 17:49 ` Uwe Kleine-König
2023-09-19 17:49 ` [PATCH 21/49] iio: adc: stm32-adc: " Uwe Kleine-König
` (7 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:49 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Maxime Coquelin, Alexandre Torgue,
Olivier Moysan, Fabrice Gasnier, Rob Herring, Heiko Stuebner,
Zhang Shurong, Yangtao Li, linux-iio, linux-stm32,
linux-arm-kernel, kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/adc/stm32-adc-core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c
index bbd5bdd732f0..c19506b0aac8 100644
--- a/drivers/iio/adc/stm32-adc-core.c
+++ b/drivers/iio/adc/stm32-adc-core.c
@@ -819,7 +819,7 @@ static int stm32_adc_probe(struct platform_device *pdev)
return ret;
}
-static int stm32_adc_remove(struct platform_device *pdev)
+static void stm32_adc_remove(struct platform_device *pdev)
{
struct stm32_adc_common *common = platform_get_drvdata(pdev);
struct stm32_adc_priv *priv = to_stm32_adc_priv(common);
@@ -831,8 +831,6 @@ static int stm32_adc_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
-
- return 0;
}
static int stm32_adc_core_runtime_suspend(struct device *dev)
@@ -913,7 +911,7 @@ MODULE_DEVICE_TABLE(of, stm32_adc_of_match);
static struct platform_driver stm32_adc_driver = {
.probe = stm32_adc_probe,
- .remove = stm32_adc_remove,
+ .remove_new = stm32_adc_remove,
.driver = {
.name = "stm32-adc-core",
.of_match_table = stm32_adc_of_match,
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 21/49] iio: adc: stm32-adc: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (11 preceding siblings ...)
2023-09-19 17:49 ` [PATCH 20/49] iio: adc: stm32-adc-core: " Uwe Kleine-König
@ 2023-09-19 17:49 ` Uwe Kleine-König
2023-09-19 17:49 ` [PATCH 22/49] iio: adc: stm32-dfsdm-adc: " Uwe Kleine-König
` (6 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:49 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Maxime Coquelin, Alexandre Torgue,
Fabrice Gasnier, Olivier Moysan, Sean Nyekjaer, Andy Shevchenko,
Tom Rix, linux-iio, linux-stm32, linux-arm-kernel, kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/adc/stm32-adc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index f7613efb870d..25a912805439 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -2513,7 +2513,7 @@ static int stm32_adc_probe(struct platform_device *pdev)
return ret;
}
-static int stm32_adc_remove(struct platform_device *pdev)
+static void stm32_adc_remove(struct platform_device *pdev)
{
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct stm32_adc *adc = iio_priv(indio_dev);
@@ -2532,8 +2532,6 @@ static int stm32_adc_remove(struct platform_device *pdev)
adc->rx_buf, adc->rx_dma_buf);
dma_release_channel(adc->dma_chan);
}
-
- return 0;
}
static int stm32_adc_suspend(struct device *dev)
@@ -2659,7 +2657,7 @@ MODULE_DEVICE_TABLE(of, stm32_adc_of_match);
static struct platform_driver stm32_adc_driver = {
.probe = stm32_adc_probe,
- .remove = stm32_adc_remove,
+ .remove_new = stm32_adc_remove,
.driver = {
.name = "stm32-adc",
.of_match_table = stm32_adc_of_match,
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 22/49] iio: adc: stm32-dfsdm-adc: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (12 preceding siblings ...)
2023-09-19 17:49 ` [PATCH 21/49] iio: adc: stm32-adc: " Uwe Kleine-König
@ 2023-09-19 17:49 ` Uwe Kleine-König
2023-09-19 17:49 ` [PATCH 23/49] iio: adc: stm32-dfsdm-core: " Uwe Kleine-König
` (5 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:49 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Maxime Coquelin, Alexandre Torgue,
Rob Herring, Heiko Stuebner, Olivier Moysan, linux-iio,
linux-stm32, linux-arm-kernel, kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/adc/stm32-dfsdm-adc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c
index b5cc43d12b6f..ca08ae3108b2 100644
--- a/drivers/iio/adc/stm32-dfsdm-adc.c
+++ b/drivers/iio/adc/stm32-dfsdm-adc.c
@@ -1620,7 +1620,7 @@ static int stm32_dfsdm_adc_probe(struct platform_device *pdev)
return ret;
}
-static int stm32_dfsdm_adc_remove(struct platform_device *pdev)
+static void stm32_dfsdm_adc_remove(struct platform_device *pdev)
{
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
@@ -1629,8 +1629,6 @@ static int stm32_dfsdm_adc_remove(struct platform_device *pdev)
of_platform_depopulate(&pdev->dev);
iio_device_unregister(indio_dev);
stm32_dfsdm_dma_release(indio_dev);
-
- return 0;
}
static int stm32_dfsdm_adc_suspend(struct device *dev)
@@ -1677,7 +1675,7 @@ static struct platform_driver stm32_dfsdm_adc_driver = {
.pm = pm_sleep_ptr(&stm32_dfsdm_adc_pm_ops),
},
.probe = stm32_dfsdm_adc_probe,
- .remove = stm32_dfsdm_adc_remove,
+ .remove_new = stm32_dfsdm_adc_remove,
};
module_platform_driver(stm32_dfsdm_adc_driver);
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 23/49] iio: adc: stm32-dfsdm-core: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (13 preceding siblings ...)
2023-09-19 17:49 ` [PATCH 22/49] iio: adc: stm32-dfsdm-adc: " Uwe Kleine-König
@ 2023-09-19 17:49 ` Uwe Kleine-König
2023-09-19 17:49 ` [PATCH 24/49] iio: adc: sun4i-gpadc-iio: " Uwe Kleine-König
` (4 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:49 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Maxime Coquelin, Alexandre Torgue,
Rob Herring, Olivier Moysan, Heiko Stuebner, linux-iio,
linux-stm32, linux-arm-kernel, kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/adc/stm32-dfsdm-core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/stm32-dfsdm-core.c b/drivers/iio/adc/stm32-dfsdm-core.c
index 0f6ebb3061a0..a05d978b8cb8 100644
--- a/drivers/iio/adc/stm32-dfsdm-core.c
+++ b/drivers/iio/adc/stm32-dfsdm-core.c
@@ -436,7 +436,7 @@ static int stm32_dfsdm_probe(struct platform_device *pdev)
return ret;
}
-static int stm32_dfsdm_core_remove(struct platform_device *pdev)
+static void stm32_dfsdm_core_remove(struct platform_device *pdev)
{
struct stm32_dfsdm *dfsdm = platform_get_drvdata(pdev);
@@ -446,8 +446,6 @@ static int stm32_dfsdm_core_remove(struct platform_device *pdev)
pm_runtime_set_suspended(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
stm32_dfsdm_clk_disable_unprepare(dfsdm);
-
- return 0;
}
static int stm32_dfsdm_core_suspend(struct device *dev)
@@ -508,7 +506,7 @@ static const struct dev_pm_ops stm32_dfsdm_core_pm_ops = {
static struct platform_driver stm32_dfsdm_driver = {
.probe = stm32_dfsdm_probe,
- .remove = stm32_dfsdm_core_remove,
+ .remove_new = stm32_dfsdm_core_remove,
.driver = {
.name = "stm32-dfsdm",
.of_match_table = stm32_dfsdm_of_match,
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 24/49] iio: adc: sun4i-gpadc-iio: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (14 preceding siblings ...)
2023-09-19 17:49 ` [PATCH 23/49] iio: adc: stm32-dfsdm-core: " Uwe Kleine-König
@ 2023-09-19 17:49 ` Uwe Kleine-König
2023-09-19 17:58 ` Jernej Škrabec
2023-09-19 17:49 ` [PATCH 30/49] iio: dac: lpc18xx_dac: " Uwe Kleine-König
` (3 subsequent siblings)
19 siblings, 1 reply; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:49 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Rafael J. Wysocki, Damien Le Moal, Mark Brown, Ido Schimmel,
Heiko Stuebner, Daniel Lezcano, Rob Herring, linux-iio,
linux-arm-kernel, linux-sunxi, kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/adc/sun4i-gpadc-iio.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
index 25bba96367a8..100ecced5fc1 100644
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
@@ -669,7 +669,7 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
return ret;
}
-static int sun4i_gpadc_remove(struct platform_device *pdev)
+static void sun4i_gpadc_remove(struct platform_device *pdev)
{
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct sun4i_gpadc_iio *info = iio_priv(indio_dev);
@@ -678,12 +678,10 @@ static int sun4i_gpadc_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
if (!IS_ENABLED(CONFIG_THERMAL_OF))
- return 0;
+ return;
if (!info->no_irq)
iio_map_array_unregister(indio_dev);
-
- return 0;
}
static const struct platform_device_id sun4i_gpadc_id[] = {
@@ -702,7 +700,7 @@ static struct platform_driver sun4i_gpadc_driver = {
},
.id_table = sun4i_gpadc_id,
.probe = sun4i_gpadc_probe,
- .remove = sun4i_gpadc_remove,
+ .remove_new = sun4i_gpadc_remove,
};
MODULE_DEVICE_TABLE(of, sun4i_gpadc_of_id);
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH 24/49] iio: adc: sun4i-gpadc-iio: Convert to platform remove callback returning void
2023-09-19 17:49 ` [PATCH 24/49] iio: adc: sun4i-gpadc-iio: " Uwe Kleine-König
@ 2023-09-19 17:58 ` Jernej Škrabec
0 siblings, 0 replies; 23+ messages in thread
From: Jernej Škrabec @ 2023-09-19 17:58 UTC (permalink / raw)
To: Jonathan Cameron, Uwe Kleine-König
Cc: Lars-Peter Clausen, Chen-Yu Tsai, Samuel Holland,
Rafael J. Wysocki, Damien Le Moal, Mark Brown, Ido Schimmel,
Heiko Stuebner, Daniel Lezcano, Rob Herring, linux-iio,
linux-arm-kernel, linux-sunxi, kernel
Dne torek, 19. september 2023 ob 19:49:06 CEST je Uwe Kleine-König napisal(a):
> 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: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
> ---
> drivers/iio/adc/sun4i-gpadc-iio.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c
> b/drivers/iio/adc/sun4i-gpadc-iio.c index 25bba96367a8..100ecced5fc1 100644
> --- a/drivers/iio/adc/sun4i-gpadc-iio.c
> +++ b/drivers/iio/adc/sun4i-gpadc-iio.c
> @@ -669,7 +669,7 @@ static int sun4i_gpadc_probe(struct platform_device
> *pdev) return ret;
> }
>
> -static int sun4i_gpadc_remove(struct platform_device *pdev)
> +static void sun4i_gpadc_remove(struct platform_device *pdev)
> {
> struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> struct sun4i_gpadc_iio *info = iio_priv(indio_dev);
> @@ -678,12 +678,10 @@ static int sun4i_gpadc_remove(struct platform_device
> *pdev) pm_runtime_disable(&pdev->dev);
>
> if (!IS_ENABLED(CONFIG_THERMAL_OF))
> - return 0;
> + return;
>
> if (!info->no_irq)
> iio_map_array_unregister(indio_dev);
> -
> - return 0;
> }
>
> static const struct platform_device_id sun4i_gpadc_id[] = {
> @@ -702,7 +700,7 @@ static struct platform_driver sun4i_gpadc_driver = {
> },
> .id_table = sun4i_gpadc_id,
> .probe = sun4i_gpadc_probe,
> - .remove = sun4i_gpadc_remove,
> + .remove_new = sun4i_gpadc_remove,
> };
> MODULE_DEVICE_TABLE(of, sun4i_gpadc_of_id);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 30/49] iio: dac: lpc18xx_dac: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (15 preceding siblings ...)
2023-09-19 17:49 ` [PATCH 24/49] iio: adc: sun4i-gpadc-iio: " Uwe Kleine-König
@ 2023-09-19 17:49 ` Uwe Kleine-König
2023-09-19 17:49 ` [PATCH 31/49] iio: dac: stm32-dac-core: " Uwe Kleine-König
` (2 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:49 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Vladimir Zapolskiy, linux-iio,
linux-arm-kernel, kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/dac/lpc18xx_dac.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/dac/lpc18xx_dac.c b/drivers/iio/dac/lpc18xx_dac.c
index 60467c6f2c6e..b3aa4443a6a4 100644
--- a/drivers/iio/dac/lpc18xx_dac.c
+++ b/drivers/iio/dac/lpc18xx_dac.c
@@ -165,7 +165,7 @@ static int lpc18xx_dac_probe(struct platform_device *pdev)
return ret;
}
-static int lpc18xx_dac_remove(struct platform_device *pdev)
+static void lpc18xx_dac_remove(struct platform_device *pdev)
{
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct lpc18xx_dac *dac = iio_priv(indio_dev);
@@ -175,8 +175,6 @@ static int lpc18xx_dac_remove(struct platform_device *pdev)
writel(0, dac->base + LPC18XX_DAC_CTRL);
clk_disable_unprepare(dac->clk);
regulator_disable(dac->vref);
-
- return 0;
}
static const struct of_device_id lpc18xx_dac_match[] = {
@@ -187,7 +185,7 @@ MODULE_DEVICE_TABLE(of, lpc18xx_dac_match);
static struct platform_driver lpc18xx_dac_driver = {
.probe = lpc18xx_dac_probe,
- .remove = lpc18xx_dac_remove,
+ .remove_new = lpc18xx_dac_remove,
.driver = {
.name = "lpc18xx-dac",
.of_match_table = lpc18xx_dac_match,
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 31/49] iio: dac: stm32-dac-core: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (16 preceding siblings ...)
2023-09-19 17:49 ` [PATCH 30/49] iio: dac: lpc18xx_dac: " Uwe Kleine-König
@ 2023-09-19 17:49 ` Uwe Kleine-König
2023-09-19 17:49 ` [PATCH 32/49] iio: dac: stm32-dac: " Uwe Kleine-König
2023-09-19 17:49 ` [PATCH 49/49] iio: trigger: stm32-timer: " Uwe Kleine-König
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:49 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Maxime Coquelin, Alexandre Torgue, linux-iio,
linux-stm32, linux-arm-kernel, kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/dac/stm32-dac-core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c
index 83bf184e3adc..15abe048729e 100644
--- a/drivers/iio/dac/stm32-dac-core.c
+++ b/drivers/iio/dac/stm32-dac-core.c
@@ -183,7 +183,7 @@ static int stm32_dac_probe(struct platform_device *pdev)
return ret;
}
-static int stm32_dac_remove(struct platform_device *pdev)
+static void stm32_dac_remove(struct platform_device *pdev)
{
pm_runtime_get_sync(&pdev->dev);
of_platform_depopulate(&pdev->dev);
@@ -191,8 +191,6 @@ static int stm32_dac_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
-
- return 0;
}
static int stm32_dac_core_resume(struct device *dev)
@@ -249,7 +247,7 @@ MODULE_DEVICE_TABLE(of, stm32_dac_of_match);
static struct platform_driver stm32_dac_driver = {
.probe = stm32_dac_probe,
- .remove = stm32_dac_remove,
+ .remove_new = stm32_dac_remove,
.driver = {
.name = "stm32-dac-core",
.of_match_table = stm32_dac_of_match,
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 32/49] iio: dac: stm32-dac: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (17 preceding siblings ...)
2023-09-19 17:49 ` [PATCH 31/49] iio: dac: stm32-dac-core: " Uwe Kleine-König
@ 2023-09-19 17:49 ` Uwe Kleine-König
2023-09-19 17:49 ` [PATCH 49/49] iio: trigger: stm32-timer: " Uwe Kleine-König
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:49 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Maxime Coquelin, Alexandre Torgue,
Andy Shevchenko, linux-iio, linux-stm32, linux-arm-kernel, kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/dac/stm32-dac.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/dac/stm32-dac.c b/drivers/iio/dac/stm32-dac.c
index 3cab28c7ee3b..5a722f307e7e 100644
--- a/drivers/iio/dac/stm32-dac.c
+++ b/drivers/iio/dac/stm32-dac.c
@@ -362,7 +362,7 @@ static int stm32_dac_probe(struct platform_device *pdev)
return ret;
}
-static int stm32_dac_remove(struct platform_device *pdev)
+static void stm32_dac_remove(struct platform_device *pdev)
{
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
@@ -371,8 +371,6 @@ static int stm32_dac_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
-
- return 0;
}
static int stm32_dac_suspend(struct device *dev)
@@ -400,7 +398,7 @@ MODULE_DEVICE_TABLE(of, stm32_dac_of_match);
static struct platform_driver stm32_dac_driver = {
.probe = stm32_dac_probe,
- .remove = stm32_dac_remove,
+ .remove_new = stm32_dac_remove,
.driver = {
.name = "stm32-dac",
.of_match_table = stm32_dac_of_match,
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 49/49] iio: trigger: stm32-timer: Convert to platform remove callback returning void
[not found] <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de>
` (18 preceding siblings ...)
2023-09-19 17:49 ` [PATCH 32/49] iio: dac: stm32-dac: " Uwe Kleine-König
@ 2023-09-19 17:49 ` Uwe Kleine-König
19 siblings, 0 replies; 23+ messages in thread
From: Uwe Kleine-König @ 2023-09-19 17:49 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Maxime Coquelin, Alexandre Torgue, linux-iio,
linux-stm32, linux-arm-kernel, kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/iio/trigger/stm32-timer-trigger.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/trigger/stm32-timer-trigger.c b/drivers/iio/trigger/stm32-timer-trigger.c
index 3643c4afae67..d76444030a28 100644
--- a/drivers/iio/trigger/stm32-timer-trigger.c
+++ b/drivers/iio/trigger/stm32-timer-trigger.c
@@ -809,7 +809,7 @@ static int stm32_timer_trigger_probe(struct platform_device *pdev)
return 0;
}
-static int stm32_timer_trigger_remove(struct platform_device *pdev)
+static void stm32_timer_trigger_remove(struct platform_device *pdev)
{
struct stm32_timer_trigger *priv = platform_get_drvdata(pdev);
u32 val;
@@ -824,8 +824,6 @@ static int stm32_timer_trigger_remove(struct platform_device *pdev)
if (priv->enabled)
clk_disable(priv->clk);
-
- return 0;
}
static int stm32_timer_trigger_suspend(struct device *dev)
@@ -904,7 +902,7 @@ MODULE_DEVICE_TABLE(of, stm32_trig_of_match);
static struct platform_driver stm32_timer_trigger_driver = {
.probe = stm32_timer_trigger_probe,
- .remove = stm32_timer_trigger_remove,
+ .remove_new = stm32_timer_trigger_remove,
.driver = {
.name = "stm32-timer-trigger",
.of_match_table = stm32_trig_of_match,
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 23+ messages in thread