* [PATCH 00/12] hwrng: Convert to platform remove callback returning
@ 2023-12-10 22:12 Uwe Kleine-König
2023-12-10 22:12 ` [PATCH 01/12] hwrng: atmel - Convert to platform remove callback returning void Uwe Kleine-König
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2023-12-10 22:12 UTC (permalink / raw)
To: Olivia Mackall, Herbert Xu
Cc: Alexandre Belloni, Tomer Maimon, Martin Kaiser, Alexandre Torgue,
Claudiu Beznea, Alim Akhtar, linux-stm32, Rob Herring,
linux-samsung-soc, Benjamin Fair, openbmc, Nancy Yuen, Hadar Gat,
Deepak Saxena, kernel, Yangtao Li, Yu Zhe, Andrei Coardos,
Łukasz Stelmach, Tali Perry, Alexandru Ardelean,
linux-arm-kernel, Avi Fishman, Patrick Venture,
Krzysztof Kozlowski, linux-crypto, Maxime Coquelin,
Gatien Chevallier
Hello,
this series converts all hwrng platform drivers to use .remove_new.
See commit 5c5a7680e67b ("platform: Provide a remove callback that
returns no value") for details and the eventual goal.
All driver conversions are trivial as all their remove callbacks return
0 (as good drivers should do).
All patches are pairwise independant. These patches should go in via the
usual hwrng tree. It's merge window material.
Best regards
Uwe
Uwe Kleine-König (12):
hwrng: atmel - Convert to platform remove callback returning void
hwrng: cctrng - Convert to platform remove callback returning void
hwrng: exynos - Convert to platform remove callback returning void
hwrng: ingenic - Convert to platform remove callback returning void
hwrng: ks-sa - Convert to platform remove callback returning void
hwrng: mxc - Convert to platform remove callback returning void
hwrng: n2 - Convert to platform remove callback returning void
hwrng: npcm - Convert to platform remove callback returning void
hwrng: omap - Convert to platform remove callback returning void
hwrng: stm32 - Convert to platform remove callback returning void
hwrng: timeriomem - Convert to platform remove callback returning void
hwrng: xgene - Convert to platform remove callback returning void
drivers/char/hw_random/atmel-rng.c | 6 ++----
drivers/char/hw_random/cctrng.c | 6 ++----
drivers/char/hw_random/exynos-trng.c | 6 ++----
drivers/char/hw_random/ingenic-rng.c | 6 ++----
drivers/char/hw_random/ks-sa-rng.c | 6 ++----
drivers/char/hw_random/mxc-rnga.c | 6 ++----
drivers/char/hw_random/n2-drv.c | 6 ++----
drivers/char/hw_random/npcm-rng.c | 6 ++----
drivers/char/hw_random/omap-rng.c | 6 ++----
drivers/char/hw_random/stm32-rng.c | 6 ++----
drivers/char/hw_random/timeriomem-rng.c | 6 ++----
drivers/char/hw_random/xgene-rng.c | 6 ++----
12 files changed, 24 insertions(+), 48 deletions(-)
base-commit: bc63de6e6ba0b16652c5fb4b9c9916b9e7ca1f23
--
2.42.0
_______________________________________________
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] 7+ messages in thread
* [PATCH 01/12] hwrng: atmel - Convert to platform remove callback returning void
2023-12-10 22:12 [PATCH 00/12] hwrng: Convert to platform remove callback returning Uwe Kleine-König
@ 2023-12-10 22:12 ` Uwe Kleine-König
2023-12-11 8:57 ` Nicolas Ferre
2023-12-10 22:12 ` [PATCH 03/12] hwrng: exynos " Uwe Kleine-König
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2023-12-10 22:12 UTC (permalink / raw)
To: Olivia Mackall, Herbert Xu
Cc: Rob Herring, Alexandre Belloni, Claudiu Beznea, linux-crypto,
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/char/hw_random/atmel-rng.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
index a37367ebcbac..e9157255f851 100644
--- a/drivers/char/hw_random/atmel-rng.c
+++ b/drivers/char/hw_random/atmel-rng.c
@@ -161,15 +161,13 @@ static int atmel_trng_probe(struct platform_device *pdev)
return ret;
}
-static int atmel_trng_remove(struct platform_device *pdev)
+static void atmel_trng_remove(struct platform_device *pdev)
{
struct atmel_trng *trng = platform_get_drvdata(pdev);
atmel_trng_cleanup(trng);
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
-
- return 0;
}
static int __maybe_unused atmel_trng_runtime_suspend(struct device *dev)
@@ -218,7 +216,7 @@ MODULE_DEVICE_TABLE(of, atmel_trng_dt_ids);
static struct platform_driver atmel_trng_driver = {
.probe = atmel_trng_probe,
- .remove = atmel_trng_remove,
+ .remove_new = atmel_trng_remove,
.driver = {
.name = "atmel-trng",
.pm = pm_ptr(&atmel_trng_pm_ops),
--
2.42.0
_______________________________________________
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] 7+ messages in thread
* [PATCH 03/12] hwrng: exynos - Convert to platform remove callback returning void
2023-12-10 22:12 [PATCH 00/12] hwrng: Convert to platform remove callback returning Uwe Kleine-König
2023-12-10 22:12 ` [PATCH 01/12] hwrng: atmel - Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-12-10 22:12 ` Uwe Kleine-König
[not found] ` <CGME20231212093133eucas1p1c19ba5aa058ca1e159bfd070aec0f306@eucas1p1.samsung.com>
2023-12-10 22:12 ` [PATCH 10/12] hwrng: stm32 " Uwe Kleine-König
2023-12-15 9:58 ` [PATCH 00/12] hwrng: Convert to platform remove callback returning Herbert Xu
3 siblings, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2023-12-10 22:12 UTC (permalink / raw)
To: Olivia Mackall, Herbert Xu
Cc: Łukasz Stelmach, Krzysztof Kozlowski, Alim Akhtar,
linux-samsung-soc, linux-crypto, 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/char/hw_random/exynos-trng.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c
index 30207b7ac5f4..0ed5d22fe667 100644
--- a/drivers/char/hw_random/exynos-trng.c
+++ b/drivers/char/hw_random/exynos-trng.c
@@ -173,7 +173,7 @@ static int exynos_trng_probe(struct platform_device *pdev)
return ret;
}
-static int exynos_trng_remove(struct platform_device *pdev)
+static void exynos_trng_remove(struct platform_device *pdev)
{
struct exynos_trng_dev *trng = platform_get_drvdata(pdev);
@@ -181,8 +181,6 @@ static int exynos_trng_remove(struct platform_device *pdev)
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
-
- return 0;
}
static int exynos_trng_suspend(struct device *dev)
@@ -223,7 +221,7 @@ static struct platform_driver exynos_trng_driver = {
.of_match_table = exynos_trng_dt_match,
},
.probe = exynos_trng_probe,
- .remove = exynos_trng_remove,
+ .remove_new = exynos_trng_remove,
};
module_platform_driver(exynos_trng_driver);
--
2.42.0
_______________________________________________
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] 7+ messages in thread
* [PATCH 10/12] hwrng: stm32 - Convert to platform remove callback returning void
2023-12-10 22:12 [PATCH 00/12] hwrng: Convert to platform remove callback returning Uwe Kleine-König
2023-12-10 22:12 ` [PATCH 01/12] hwrng: atmel - Convert to platform remove callback returning void Uwe Kleine-König
2023-12-10 22:12 ` [PATCH 03/12] hwrng: exynos " Uwe Kleine-König
@ 2023-12-10 22:12 ` Uwe Kleine-König
2023-12-15 9:58 ` [PATCH 00/12] hwrng: Convert to platform remove callback returning Herbert Xu
3 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2023-12-10 22:12 UTC (permalink / raw)
To: Olivia Mackall, Herbert Xu
Cc: Maxime Coquelin, Alexandre Torgue, Gatien Chevallier, Rob Herring,
linux-crypto, 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/char/hw_random/stm32-rng.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c
index 41e1dbea5d2e..98c92b914cfd 100644
--- a/drivers/char/hw_random/stm32-rng.c
+++ b/drivers/char/hw_random/stm32-rng.c
@@ -362,11 +362,9 @@ static int stm32_rng_init(struct hwrng *rng)
return 0;
}
-static int stm32_rng_remove(struct platform_device *ofdev)
+static void stm32_rng_remove(struct platform_device *ofdev)
{
pm_runtime_disable(&ofdev->dev);
-
- return 0;
}
static int __maybe_unused stm32_rng_runtime_suspend(struct device *dev)
@@ -557,7 +555,7 @@ static struct platform_driver stm32_rng_driver = {
.of_match_table = stm32_rng_match,
},
.probe = stm32_rng_probe,
- .remove = stm32_rng_remove,
+ .remove_new = stm32_rng_remove,
};
module_platform_driver(stm32_rng_driver);
--
2.42.0
_______________________________________________
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] 7+ messages in thread
* Re: [PATCH 01/12] hwrng: atmel - Convert to platform remove callback returning void
2023-12-10 22:12 ` [PATCH 01/12] hwrng: atmel - Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-12-11 8:57 ` Nicolas Ferre
0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Ferre @ 2023-12-11 8:57 UTC (permalink / raw)
To: Uwe Kleine-König, Olivia Mackall, Herbert Xu
Cc: Alexandre Belloni, Claudiu Beznea, Rob Herring, linux-crypto,
linux-arm-kernel, kernel
On 10/12/2023 at 23:12, 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>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> ---
> drivers/char/hw_random/atmel-rng.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
> index a37367ebcbac..e9157255f851 100644
> --- a/drivers/char/hw_random/atmel-rng.c
> +++ b/drivers/char/hw_random/atmel-rng.c
> @@ -161,15 +161,13 @@ static int atmel_trng_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int atmel_trng_remove(struct platform_device *pdev)
> +static void atmel_trng_remove(struct platform_device *pdev)
> {
> struct atmel_trng *trng = platform_get_drvdata(pdev);
>
> atmel_trng_cleanup(trng);
> pm_runtime_disable(&pdev->dev);
> pm_runtime_set_suspended(&pdev->dev);
> -
> - return 0;
> }
>
> static int __maybe_unused atmel_trng_runtime_suspend(struct device *dev)
> @@ -218,7 +216,7 @@ MODULE_DEVICE_TABLE(of, atmel_trng_dt_ids);
>
> static struct platform_driver atmel_trng_driver = {
> .probe = atmel_trng_probe,
> - .remove = atmel_trng_remove,
> + .remove_new = atmel_trng_remove,
> .driver = {
> .name = "atmel-trng",
> .pm = pm_ptr(&atmel_trng_pm_ops),
> --
> 2.42.0
>
_______________________________________________
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] 7+ messages in thread
* Re: [PATCH 03/12] hwrng: exynos - Convert to platform remove callback returning void
[not found] ` <CGME20231212093133eucas1p1c19ba5aa058ca1e159bfd070aec0f306@eucas1p1.samsung.com>
@ 2023-12-12 9:31 ` Lukasz Stelmach
0 siblings, 0 replies; 7+ messages in thread
From: Lukasz Stelmach @ 2023-12-12 9:31 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Olivia Mackall, Herbert Xu, Krzysztof Kozlowski, Alim Akhtar,
linux-samsung-soc, linux-crypto, linux-arm-kernel, kernel
[-- Attachment #1.1: Type: text/plain, Size: 2167 bytes --]
It was <2023-12-10 nie 23:12>, when 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/char/hw_random/exynos-trng.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
Acked-by: Lukasz Stelmach <l.stelmach@samsung.com>
> diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c
> index 30207b7ac5f4..0ed5d22fe667 100644
> --- a/drivers/char/hw_random/exynos-trng.c
> +++ b/drivers/char/hw_random/exynos-trng.c
> @@ -173,7 +173,7 @@ static int exynos_trng_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int exynos_trng_remove(struct platform_device *pdev)
> +static void exynos_trng_remove(struct platform_device *pdev)
> {
> struct exynos_trng_dev *trng = platform_get_drvdata(pdev);
>
> @@ -181,8 +181,6 @@ static int exynos_trng_remove(struct platform_device *pdev)
>
> pm_runtime_put_sync(&pdev->dev);
> pm_runtime_disable(&pdev->dev);
> -
> - return 0;
> }
>
> static int exynos_trng_suspend(struct device *dev)
> @@ -223,7 +221,7 @@ static struct platform_driver exynos_trng_driver = {
> .of_match_table = exynos_trng_dt_match,
> },
> .probe = exynos_trng_probe,
> - .remove = exynos_trng_remove,
> + .remove_new = exynos_trng_remove,
> };
>
> module_platform_driver(exynos_trng_driver);
--
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 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] 7+ messages in thread
* Re: [PATCH 00/12] hwrng: Convert to platform remove callback returning
2023-12-10 22:12 [PATCH 00/12] hwrng: Convert to platform remove callback returning Uwe Kleine-König
` (2 preceding siblings ...)
2023-12-10 22:12 ` [PATCH 10/12] hwrng: stm32 " Uwe Kleine-König
@ 2023-12-15 9:58 ` Herbert Xu
3 siblings, 0 replies; 7+ messages in thread
From: Herbert Xu @ 2023-12-15 9:58 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Alexandre Belloni, Tomer Maimon, Martin Kaiser, Alexandre Torgue,
Claudiu Beznea, Alim Akhtar, linux-stm32, Rob Herring,
linux-samsung-soc, Benjamin Fair, openbmc, Nancy Yuen, Hadar Gat,
Deepak Saxena, Maxime Coquelin, Yangtao Li, Yu Zhe,
Andrei Coardos, Łukasz Stelmach, Olivia Mackall, Tali Perry,
Alexandru Ardelean, linux-arm-kernel, Avi Fishman,
Patrick Venture, Krzysztof Kozlowski, linux-crypto, kernel,
Gatien Chevallier
On Sun, Dec 10, 2023 at 11:12:15PM +0100, Uwe Kleine-König wrote:
> Hello,
>
> this series converts all hwrng platform drivers to use .remove_new.
> See commit 5c5a7680e67b ("platform: Provide a remove callback that
> returns no value") for details and the eventual goal.
>
> All driver conversions are trivial as all their remove callbacks return
> 0 (as good drivers should do).
>
> All patches are pairwise independant. These patches should go in via the
> usual hwrng tree. It's merge window material.
>
> Best regards
> Uwe
>
> Uwe Kleine-König (12):
> hwrng: atmel - Convert to platform remove callback returning void
> hwrng: cctrng - Convert to platform remove callback returning void
> hwrng: exynos - Convert to platform remove callback returning void
> hwrng: ingenic - Convert to platform remove callback returning void
> hwrng: ks-sa - Convert to platform remove callback returning void
> hwrng: mxc - Convert to platform remove callback returning void
> hwrng: n2 - Convert to platform remove callback returning void
> hwrng: npcm - Convert to platform remove callback returning void
> hwrng: omap - Convert to platform remove callback returning void
> hwrng: stm32 - Convert to platform remove callback returning void
> hwrng: timeriomem - Convert to platform remove callback returning void
> hwrng: xgene - Convert to platform remove callback returning void
>
> drivers/char/hw_random/atmel-rng.c | 6 ++----
> drivers/char/hw_random/cctrng.c | 6 ++----
> drivers/char/hw_random/exynos-trng.c | 6 ++----
> drivers/char/hw_random/ingenic-rng.c | 6 ++----
> drivers/char/hw_random/ks-sa-rng.c | 6 ++----
> drivers/char/hw_random/mxc-rnga.c | 6 ++----
> drivers/char/hw_random/n2-drv.c | 6 ++----
> drivers/char/hw_random/npcm-rng.c | 6 ++----
> drivers/char/hw_random/omap-rng.c | 6 ++----
> drivers/char/hw_random/stm32-rng.c | 6 ++----
> drivers/char/hw_random/timeriomem-rng.c | 6 ++----
> drivers/char/hw_random/xgene-rng.c | 6 ++----
> 12 files changed, 24 insertions(+), 48 deletions(-)
>
>
> base-commit: bc63de6e6ba0b16652c5fb4b9c9916b9e7ca1f23
> --
> 2.42.0
All applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
_______________________________________________
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] 7+ messages in thread
end of thread, other threads:[~2023-12-15 9:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-10 22:12 [PATCH 00/12] hwrng: Convert to platform remove callback returning Uwe Kleine-König
2023-12-10 22:12 ` [PATCH 01/12] hwrng: atmel - Convert to platform remove callback returning void Uwe Kleine-König
2023-12-11 8:57 ` Nicolas Ferre
2023-12-10 22:12 ` [PATCH 03/12] hwrng: exynos " Uwe Kleine-König
[not found] ` <CGME20231212093133eucas1p1c19ba5aa058ca1e159bfd070aec0f306@eucas1p1.samsung.com>
2023-12-12 9:31 ` Lukasz Stelmach
2023-12-10 22:12 ` [PATCH 10/12] hwrng: stm32 " Uwe Kleine-König
2023-12-15 9:58 ` [PATCH 00/12] hwrng: Convert to platform remove callback returning Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).