* [PATCH 24/49] iio: adc: sun4i-gpadc-iio: Convert to platform remove callback returning void
2023-09-19 17:48 [PATCH 00/49] iio: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-09-19 17:49 ` Uwe Kleine-König
2023-09-19 17:58 ` Jernej Škrabec
2023-09-23 17:35 ` [PATCH 00/49] iio: " Jonathan Cameron
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ 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
^ permalink raw reply related [flat|nested] 6+ 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; 6+ 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);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 00/49] iio: Convert to platform remove callback returning void
2023-09-19 17:48 [PATCH 00/49] iio: Convert to platform remove callback returning void Uwe Kleine-König
2023-09-19 17:49 ` [PATCH 24/49] iio: adc: sun4i-gpadc-iio: " Uwe Kleine-König
@ 2023-09-23 17:35 ` Jonathan Cameron
2023-11-13 3:23 ` patchwork-bot+chrome-platform
2023-11-13 3:42 ` patchwork-bot+chrome-platform
3 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2023-09-23 17:35 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Jiri Kosina, Srinivas Pandruvada, Lars-Peter Clausen, linux-input,
linux-iio, kernel, Linus Walleij, linux-arm-kernel, Eugen Hristev,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Jinjie Ruan,
Rob Herring, Heiko Stuebner, Yang Yingliang, Chen-Yu Tsai,
Aidan MacDonald, Andy Shevchenko, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Hartley Sweeten,
Alexander Sverdlin, Krzysztof Kozlowski, Alim Akhtar,
linux-samsung-soc, Shawn Guo, Sascha Hauer, Fabio Estevam,
NXP Linux Team, Andreas Klinger, Cai Huoqing, Haibo Chen,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
George Stark, Andy Shevchenko, Nuno Sá, linux-amlogic,
Saravanan Sekar, Jiakai Luo, Dongliang Mu, Avi Fishman,
Tomer Maimon, Tali Perry, Patrick Venture, Nancy Yuen,
Benjamin Fair, openbmc, Andy Gross, Bjorn Andersson,
Konrad Dybcio, linux-arm-msm, Marek Vasut, Maxime Coquelin,
Alexandre Torgue, Olivier Moysan, Fabrice Gasnier, Zhang Shurong,
Yangtao Li, linux-stm32, Sean Nyekjaer, Tom Rix, Jernej Skrabec,
Samuel Holland, Rafael J. Wysocki, Damien Le Moal, Mark Brown,
Ido Schimmel, Daniel Lezcano, linux-sunxi, Dmitry Torokhov,
Andreas Kemnade, Peter Rosin, Vladimir Zapolskiy, Kevin Tsai,
Benson Leung, Guenter Roeck, chrome-platform
On Tue, 19 Sep 2023 19:48:42 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> this series converts all platform drivers below drivers/iio 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. As all platform drivers return zero unconditionally in their
> remove callback up to now, the conversions are "trivial".
>
> 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 I picked a wrong subject prefix, please apply the remainder of
> this series anyhow.
>
Series applied to the togreg branch of iio.git and pushed out as testing
to see if 0-day finds anything we are missing.
I've picked up all tags give as of early today.
Thanks,
Jonathan
> Best regards
> Uwe
>
> Uwe Kleine-König (49):
> iio: accel: hid-sensor-accel-3d: Convert to platform remove callback
> returning void
> iio: adc: ab8500-gpadc: Convert to platform remove callback returning
> void
> iio: adc: at91-sama5d2: Convert to platform remove callback returning
> void
> iio: adc: at91: Convert to platform remove callback returning void
> iio: adc: axp20x: Convert to platform remove callback returning void
> iio: adc: bcm_iproc: Convert to platform remove callback returning
> void
> iio: adc: dln2: Convert to platform remove callback returning void
> iio: adc: ep93xx: Convert to platform remove callback returning void
> iio: adc: exynos: Convert to platform remove callback returning void
> iio: adc: fsl-imx25-gcq: Convert to platform remove callback returning
> void
> iio: adc: hx711: Convert to platform remove callback returning void
> iio: adc: imx8qxp: Convert to platform remove callback returning void
> iio: adc: imx93: Convert to platform remove callback returning void
> iio: adc: meson_saradc: Convert to platform remove callback returning
> void
> iio: adc: mp2629: Convert to platform remove callback returning void
> iio: adc: mxs-lradc: Convert to platform remove callback returning
> void
> iio: adc: npcm: Convert to platform remove callback returning void
> iio: adc: qcom-pm8xxx-xoadc: Convert to platform remove callback
> returning void
> iio: adc: rcar-gyroadc: Convert to platform remove callback returning
> void
> iio: adc: stm32-adc-core: Convert to platform remove callback
> returning void
> iio: adc: stm32-adc: Convert to platform remove callback returning
> void
> iio: adc: stm32-dfsdm-adc: Convert to platform remove callback
> returning void
> iio: adc: stm32-dfsdm-core: Convert to platform remove callback
> returning void
> iio: adc: sun4i-gpadc-iio: Convert to platform remove callback
> returning void
> iio: adc: ti_am335x_adc: Convert to platform remove callback returning
> void
> iio: adc: twl4030-madc: Convert to platform remove callback returning
> void
> iio: adc: twl6030-gpadc: Convert to platform remove callback returning
> void
> iio: adc: vf610_adc: Convert to platform remove callback returning
> void
> iio: dac: dpot-dac: Convert to platform remove callback returning void
> iio: dac: lpc18xx_dac: Convert to platform remove callback returning
> void
> iio: dac: stm32-dac-core: Convert to platform remove callback
> returning void
> iio: dac: stm32-dac: Convert to platform remove callback returning
> void
> iio: dac: vf610: Convert to platform remove callback returning void
> iio: gyro: hid-sensor-gyro-3d: Convert to platform remove callback
> returning void
> iio: humidity: hid-sensor-humidity: Convert to platform remove
> callback returning void
> iio: light: cm3605: Convert to platform remove callback returning void
> iio: light: hid-sensor-als: Convert to platform remove callback
> returning void
> iio: light: hid-sensor-prox: Convert to platform remove callback
> returning void
> iio: light: lm3533-als: Convert to platform remove callback returning
> void
> iio: magnetometer: hid-sensor-magn-3d: Convert to platform remove
> callback returning void
> iio: orientation: hid-sensor-incl-3d: Convert to platform remove
> callback returning void
> iio: orientation: hid-sensor-rotation: Convert to platform remove
> callback returning void
> iio: position: hid-sensor-custom-intel-hinge: Convert to platform
> remove callback returning void
> iio: pressure: hid-sensor: Convert to platform remove callback
> returning void
> iio: proximity: cros_ec_mkbp: Convert to platform remove callback
> returning void
> iio: proximity: srf04: Convert to platform remove callback returning
> void
> iio: temperature: hid-sensor: Convert to platform remove callback
> returning void
> iio: trigger: iio-trig-interrupt: Convert to platform remove callback
> returning void
> iio: trigger: stm32-timer: Convert to platform remove callback
> returning void
>
> drivers/iio/accel/hid-sensor-accel-3d.c | 6 ++----
> drivers/iio/adc/ab8500-gpadc.c | 6 ++----
> drivers/iio/adc/at91-sama5d2_adc.c | 6 ++----
> drivers/iio/adc/at91_adc.c | 6 ++----
> drivers/iio/adc/axp20x_adc.c | 6 ++----
> drivers/iio/adc/bcm_iproc_adc.c | 6 ++----
> drivers/iio/adc/dln2-adc.c | 5 ++---
> drivers/iio/adc/ep93xx_adc.c | 6 ++----
> drivers/iio/adc/exynos_adc.c | 6 ++----
> drivers/iio/adc/fsl-imx25-gcq.c | 6 ++----
> drivers/iio/adc/hx711.c | 6 ++----
> drivers/iio/adc/imx8qxp-adc.c | 6 ++----
> drivers/iio/adc/imx93_adc.c | 6 ++----
> drivers/iio/adc/meson_saradc.c | 6 ++----
> drivers/iio/adc/mp2629_adc.c | 6 ++----
> drivers/iio/adc/mxs-lradc-adc.c | 6 ++----
> drivers/iio/adc/npcm_adc.c | 6 ++----
> drivers/iio/adc/qcom-pm8xxx-xoadc.c | 6 ++----
> drivers/iio/adc/rcar-gyroadc.c | 6 ++----
> drivers/iio/adc/stm32-adc-core.c | 6 ++----
> drivers/iio/adc/stm32-adc.c | 6 ++----
> drivers/iio/adc/stm32-dfsdm-adc.c | 6 ++----
> drivers/iio/adc/stm32-dfsdm-core.c | 6 ++----
> drivers/iio/adc/sun4i-gpadc-iio.c | 8 +++-----
> drivers/iio/adc/ti_am335x_adc.c | 6 ++----
> drivers/iio/adc/twl4030-madc.c | 6 ++----
> drivers/iio/adc/twl6030-gpadc.c | 6 ++----
> drivers/iio/adc/vf610_adc.c | 6 ++----
> drivers/iio/dac/dpot-dac.c | 6 ++----
> drivers/iio/dac/lpc18xx_dac.c | 6 ++----
> drivers/iio/dac/stm32-dac-core.c | 6 ++----
> drivers/iio/dac/stm32-dac.c | 6 ++----
> drivers/iio/dac/vf610_dac.c | 6 ++----
> drivers/iio/gyro/hid-sensor-gyro-3d.c | 6 ++----
> drivers/iio/humidity/hid-sensor-humidity.c | 6 ++----
> drivers/iio/light/cm3605.c | 6 ++----
> drivers/iio/light/hid-sensor-als.c | 6 ++----
> drivers/iio/light/hid-sensor-prox.c | 6 ++----
> drivers/iio/light/lm3533-als.c | 6 ++----
> drivers/iio/magnetometer/hid-sensor-magn-3d.c | 6 ++----
> drivers/iio/orientation/hid-sensor-incl-3d.c | 6 ++----
> drivers/iio/orientation/hid-sensor-rotation.c | 6 ++----
> drivers/iio/position/hid-sensor-custom-intel-hinge.c | 6 ++----
> drivers/iio/pressure/hid-sensor-press.c | 6 ++----
> drivers/iio/proximity/cros_ec_mkbp_proximity.c | 6 ++----
> drivers/iio/proximity/srf04.c | 6 ++----
> drivers/iio/temperature/hid-sensor-temperature.c | 6 ++----
> drivers/iio/trigger/iio-trig-interrupt.c | 6 ++----
> drivers/iio/trigger/stm32-timer-trigger.c | 6 ++----
> 49 files changed, 99 insertions(+), 196 deletions(-)
>
>
> base-commit: 29e400e3ea486bf942b214769fc9778098114113
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 00/49] iio: Convert to platform remove callback returning void
2023-09-19 17:48 [PATCH 00/49] iio: Convert to platform remove callback returning void Uwe Kleine-König
2023-09-19 17:49 ` [PATCH 24/49] iio: adc: sun4i-gpadc-iio: " Uwe Kleine-König
2023-09-23 17:35 ` [PATCH 00/49] iio: " Jonathan Cameron
@ 2023-11-13 3:23 ` patchwork-bot+chrome-platform
2023-11-13 3:42 ` patchwork-bot+chrome-platform
3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-11-13 3:23 UTC (permalink / raw)
To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?=
Cc: jic23, jikos, srinivas.pandruvada, lars, linux-input, linux-iio,
kernel, linus.walleij, linux-arm-kernel, eugen.hristev,
nicolas.ferre, alexandre.belloni, claudiu.beznea, ruanjinjie,
robh, heiko, yangyingliang, wens, aidanmacdonald.0x0,
andy.shevchenko, rjui, sbranden, bcm-kernel-feedback-list,
hsweeten, alexander.sverdlin, krzysztof.kozlowski, alim.akhtar,
linux-samsung-soc, shawnguo, s.hauer, festevam, linux-imx, ak,
cai.huoqing, haibo.chen, neil.armstrong, khilman, jbrunet,
martin.blumenstingl, gnstark, andriy.shevchenko, nuno.sa,
linux-amlogic, sravanhome, jkluo, dzm91, avifishman70, tmaimon77,
tali.perry1, venture, yuenn, benjaminfair, openbmc, agross,
andersson, konrad.dybcio, linux-arm-msm, marek.vasut,
mcoquelin.stm32, alexandre.torgue, olivier.moysan,
fabrice.gasnier, zhang_shurong, frank.li, linux-stm32, sean, trix,
jernej.skrabec, samuel, rafael.j.wysocki, damien.lemoal, broonie,
idosch, daniel.lezcano, linux-sunxi, dmitry.torokhov, andreas,
peda, vz, ktsai, bleung, groeck, chrome-platform
Hello:
This patch was applied to chrome-platform/linux.git (for-kernelci)
by Jonathan Cameron <Jonathan.Cameron@huawei.com>:
On Tue, 19 Sep 2023 19:48:42 +0200 you wrote:
> this series converts all platform drivers below drivers/iio 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. As all platform drivers return zero unconditionally in their
> remove callback up to now, the conversions are "trivial".
>
> See commit 5c5a7680e67b ("platform: Provide a remove callback that
> returns no value") for an extended explanation and the eventual goal.
>
> [...]
Here is the summary with links:
- [45/49] iio: proximity: cros_ec_mkbp: Convert to platform remove callback returning void
https://git.kernel.org/chrome-platform/c/2df694f710d2
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 00/49] iio: Convert to platform remove callback returning void
2023-09-19 17:48 [PATCH 00/49] iio: Convert to platform remove callback returning void Uwe Kleine-König
` (2 preceding siblings ...)
2023-11-13 3:23 ` patchwork-bot+chrome-platform
@ 2023-11-13 3:42 ` patchwork-bot+chrome-platform
3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-11-13 3:42 UTC (permalink / raw)
To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?=
Cc: jic23, jikos, srinivas.pandruvada, lars, linux-input, linux-iio,
kernel, linus.walleij, linux-arm-kernel, eugen.hristev,
nicolas.ferre, alexandre.belloni, claudiu.beznea, ruanjinjie,
robh, heiko, yangyingliang, wens, aidanmacdonald.0x0,
andy.shevchenko, rjui, sbranden, bcm-kernel-feedback-list,
hsweeten, alexander.sverdlin, krzysztof.kozlowski, alim.akhtar,
linux-samsung-soc, shawnguo, s.hauer, festevam, linux-imx, ak,
cai.huoqing, haibo.chen, neil.armstrong, khilman, jbrunet,
martin.blumenstingl, gnstark, andriy.shevchenko, nuno.sa,
linux-amlogic, sravanhome, jkluo, dzm91, avifishman70, tmaimon77,
tali.perry1, venture, yuenn, benjaminfair, openbmc, agross,
andersson, konrad.dybcio, linux-arm-msm, marek.vasut,
mcoquelin.stm32, alexandre.torgue, olivier.moysan,
fabrice.gasnier, zhang_shurong, frank.li, linux-stm32, sean, trix,
jernej.skrabec, samuel, rafael.j.wysocki, damien.lemoal, broonie,
idosch, daniel.lezcano, linux-sunxi, dmitry.torokhov, andreas,
peda, vz, ktsai, bleung, groeck, chrome-platform
Hello:
This patch was applied to chrome-platform/linux.git (for-next)
by Jonathan Cameron <Jonathan.Cameron@huawei.com>:
On Tue, 19 Sep 2023 19:48:42 +0200 you wrote:
> this series converts all platform drivers below drivers/iio 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. As all platform drivers return zero unconditionally in their
> remove callback up to now, the conversions are "trivial".
>
> See commit 5c5a7680e67b ("platform: Provide a remove callback that
> returns no value") for an extended explanation and the eventual goal.
>
> [...]
Here is the summary with links:
- [45/49] iio: proximity: cros_ec_mkbp: Convert to platform remove callback returning void
https://git.kernel.org/chrome-platform/c/2df694f710d2
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread