All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] hwrng: Convert to platform remove callback returning
@ 2023-12-10 22:12 ` Uwe Kleine-König
  0 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2023-12-10 22:12 UTC (permalink / raw)
  To: Olivia Mackall, Herbert Xu
  Cc: Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Rob Herring,
	linux-crypto, linux-arm-kernel, kernel, Hadar Gat,
	Łukasz Stelmach, Krzysztof Kozlowski, Alim Akhtar,
	linux-samsung-soc, Martin Kaiser, Avi Fishman, Tomer Maimon,
	Tali Perry, Patrick Venture, Nancy Yuen, Benjamin Fair, openbmc,
	Deepak Saxena, Maxime Coquelin, Alexandre Torgue,
	Gatien Chevallier, linux-stm32, Yangtao Li, Yu Zhe,
	Alexandru Ardelean, Andrei Coardos

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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 00/12] hwrng: Convert to platform remove callback returning
@ 2023-12-10 22:12 ` Uwe Kleine-König
  0 siblings, 0 replies; 25+ 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] 25+ messages in thread

* [PATCH 00/12] hwrng: Convert to platform remove callback returning
@ 2023-12-10 22:12 ` Uwe Kleine-König
  0 siblings, 0 replies; 25+ 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, Hadar Gat,
	Deepak Saxena, kernel, Yangtao Li, Yu Zhe, Andrei Coardos,
	Łukasz Stelmach, Tali Perry, Alexandru Ardelean,
	linux-arm-kernel, Avi Fishman, Patrick Venture, Nicolas Ferre,
	Krzysztof Kozlowski, linux-crypto

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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 01/12] hwrng: atmel - Convert to platform remove callback returning void
  2023-12-10 22:12 ` Uwe Kleine-König
@ 2023-12-10 22:12   ` Uwe Kleine-König
  -1 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2023-12-10 22:12 UTC (permalink / raw)
  To: Olivia Mackall, Herbert Xu
  Cc: Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Rob Herring,
	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/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


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 01/12] hwrng: atmel - Convert to platform remove callback returning void
@ 2023-12-10 22:12   ` Uwe Kleine-König
  0 siblings, 0 replies; 25+ 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] 25+ messages in thread

* [PATCH 02/12] hwrng: cctrng - Convert to platform remove callback returning void
  2023-12-10 22:12 ` Uwe Kleine-König
                   ` (2 preceding siblings ...)
  (?)
@ 2023-12-10 22:12 ` Uwe Kleine-König
  -1 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2023-12-10 22:12 UTC (permalink / raw)
  To: Olivia Mackall, Herbert Xu; +Cc: Hadar Gat, linux-crypto, 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/cctrng.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/char/hw_random/cctrng.c b/drivers/char/hw_random/cctrng.c
index 1abbff04a015..c0d2f824769f 100644
--- a/drivers/char/hw_random/cctrng.c
+++ b/drivers/char/hw_random/cctrng.c
@@ -560,7 +560,7 @@ static int cctrng_probe(struct platform_device *pdev)
 	return rc;
 }
 
-static int cctrng_remove(struct platform_device *pdev)
+static void cctrng_remove(struct platform_device *pdev)
 {
 	struct cctrng_drvdata *drvdata = platform_get_drvdata(pdev);
 	struct device *dev = &pdev->dev;
@@ -570,8 +570,6 @@ static int cctrng_remove(struct platform_device *pdev)
 	cc_trng_pm_fini(drvdata);
 
 	dev_info(dev, "ARM cctrng device terminated\n");
-
-	return 0;
 }
 
 static int __maybe_unused cctrng_suspend(struct device *dev)
@@ -654,7 +652,7 @@ static struct platform_driver cctrng_driver = {
 		.pm = &cctrng_pm,
 	},
 	.probe = cctrng_probe,
-	.remove = cctrng_remove,
+	.remove_new = cctrng_remove,
 };
 
 module_platform_driver(cctrng_driver);
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 03/12] hwrng: exynos - Convert to platform remove callback returning void
  2023-12-10 22:12 ` Uwe Kleine-König
@ 2023-12-10 22:12   ` Uwe Kleine-König
  -1 siblings, 0 replies; 25+ 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


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 03/12] hwrng: exynos - Convert to platform remove callback returning void
@ 2023-12-10 22:12   ` Uwe Kleine-König
  0 siblings, 0 replies; 25+ 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] 25+ messages in thread

* [PATCH 04/12] hwrng: ingenic - Convert to platform remove callback returning void
  2023-12-10 22:12 ` Uwe Kleine-König
                   ` (4 preceding siblings ...)
  (?)
@ 2023-12-10 22:12 ` Uwe Kleine-König
  -1 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2023-12-10 22:12 UTC (permalink / raw)
  To: Olivia Mackall, Herbert Xu; +Cc: Rob Herring, linux-crypto, 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/ingenic-rng.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/char/hw_random/ingenic-rng.c b/drivers/char/hw_random/ingenic-rng.c
index c74ded64fbe3..2f9b6483c4a1 100644
--- a/drivers/char/hw_random/ingenic-rng.c
+++ b/drivers/char/hw_random/ingenic-rng.c
@@ -114,15 +114,13 @@ static int ingenic_rng_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int ingenic_rng_remove(struct platform_device *pdev)
+static void ingenic_rng_remove(struct platform_device *pdev)
 {
 	struct ingenic_rng *priv = platform_get_drvdata(pdev);
 
 	hwrng_unregister(&priv->rng);
 
 	writel(0, priv->base + RNG_REG_ERNG_OFFSET);
-
-	return 0;
 }
 
 static const struct of_device_id ingenic_rng_of_match[] = {
@@ -134,7 +132,7 @@ MODULE_DEVICE_TABLE(of, ingenic_rng_of_match);
 
 static struct platform_driver ingenic_rng_driver = {
 	.probe		= ingenic_rng_probe,
-	.remove		= ingenic_rng_remove,
+	.remove_new	= ingenic_rng_remove,
 	.driver		= {
 		.name	= "ingenic-rng",
 		.of_match_table = ingenic_rng_of_match,
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 05/12] hwrng: ks-sa - Convert to platform remove callback returning void
  2023-12-10 22:12 ` Uwe Kleine-König
                   ` (5 preceding siblings ...)
  (?)
@ 2023-12-10 22:12 ` Uwe Kleine-König
  -1 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2023-12-10 22:12 UTC (permalink / raw)
  To: Olivia Mackall, Herbert Xu; +Cc: Martin Kaiser, linux-crypto, 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/ks-sa-rng.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/char/hw_random/ks-sa-rng.c b/drivers/char/hw_random/ks-sa-rng.c
index dff7b9db7044..36c34252b4f6 100644
--- a/drivers/char/hw_random/ks-sa-rng.c
+++ b/drivers/char/hw_random/ks-sa-rng.c
@@ -241,12 +241,10 @@ static int ks_sa_rng_probe(struct platform_device *pdev)
 	return devm_hwrng_register(&pdev->dev, &ks_sa_rng->rng);
 }
 
-static int ks_sa_rng_remove(struct platform_device *pdev)
+static void ks_sa_rng_remove(struct platform_device *pdev)
 {
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 static const struct of_device_id ks_sa_rng_dt_match[] = {
@@ -263,7 +261,7 @@ static struct platform_driver ks_sa_rng_driver = {
 		.of_match_table = ks_sa_rng_dt_match,
 	},
 	.probe		= ks_sa_rng_probe,
-	.remove		= ks_sa_rng_remove,
+	.remove_new	= ks_sa_rng_remove,
 };
 
 module_platform_driver(ks_sa_rng_driver);
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 06/12] hwrng: mxc - Convert to platform remove callback returning void
  2023-12-10 22:12 ` Uwe Kleine-König
                   ` (6 preceding siblings ...)
  (?)
@ 2023-12-10 22:12 ` Uwe Kleine-König
  -1 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2023-12-10 22:12 UTC (permalink / raw)
  To: Olivia Mackall, Herbert Xu; +Cc: linux-crypto, 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/mxc-rnga.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/char/hw_random/mxc-rnga.c b/drivers/char/hw_random/mxc-rnga.c
index 008763c988ed..07ec000e4cd7 100644
--- a/drivers/char/hw_random/mxc-rnga.c
+++ b/drivers/char/hw_random/mxc-rnga.c
@@ -176,15 +176,13 @@ static int __init mxc_rnga_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int __exit mxc_rnga_remove(struct platform_device *pdev)
+static void __exit mxc_rnga_remove(struct platform_device *pdev)
 {
 	struct mxc_rng *mxc_rng = platform_get_drvdata(pdev);
 
 	hwrng_unregister(&mxc_rng->rng);
 
 	clk_disable_unprepare(mxc_rng->clk);
-
-	return 0;
 }
 
 static const struct of_device_id mxc_rnga_of_match[] = {
@@ -199,7 +197,7 @@ static struct platform_driver mxc_rnga_driver = {
 		.name = "mxc_rnga",
 		.of_match_table = mxc_rnga_of_match,
 	},
-	.remove = __exit_p(mxc_rnga_remove),
+	.remove_new = __exit_p(mxc_rnga_remove),
 };
 
 module_platform_driver_probe(mxc_rnga_driver, mxc_rnga_probe);
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 07/12] hwrng: n2 - Convert to platform remove callback returning void
  2023-12-10 22:12 ` Uwe Kleine-König
                   ` (7 preceding siblings ...)
  (?)
@ 2023-12-10 22:12 ` Uwe Kleine-König
  -1 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2023-12-10 22:12 UTC (permalink / raw)
  To: Olivia Mackall, Herbert Xu; +Cc: Rob Herring, linux-crypto, 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/n2-drv.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c
index aaae16b98475..2e669e7c14d3 100644
--- a/drivers/char/hw_random/n2-drv.c
+++ b/drivers/char/hw_random/n2-drv.c
@@ -781,7 +781,7 @@ static int n2rng_probe(struct platform_device *op)
 	return err;
 }
 
-static int n2rng_remove(struct platform_device *op)
+static void n2rng_remove(struct platform_device *op)
 {
 	struct n2rng *np = platform_get_drvdata(op);
 
@@ -790,8 +790,6 @@ static int n2rng_remove(struct platform_device *op)
 	cancel_delayed_work_sync(&np->work);
 
 	sun4v_hvapi_unregister(HV_GRP_RNG);
-
-	return 0;
 }
 
 static struct n2rng_template n2_template = {
@@ -860,7 +858,7 @@ static struct platform_driver n2rng_driver = {
 		.of_match_table = n2rng_match,
 	},
 	.probe		= n2rng_probe,
-	.remove		= n2rng_remove,
+	.remove_new	= n2rng_remove,
 };
 
 module_platform_driver(n2rng_driver);
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 08/12] hwrng: npcm - Convert to platform remove callback returning void
  2023-12-10 22:12 ` Uwe Kleine-König
@ 2023-12-10 22:12   ` Uwe Kleine-König
  -1 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2023-12-10 22:12 UTC (permalink / raw)
  To: Olivia Mackall, Herbert Xu
  Cc: Avi Fishman, Tomer Maimon, Tali Perry, Patrick Venture,
	Nancy Yuen, Benjamin Fair, openbmc, linux-crypto, 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/npcm-rng.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/char/hw_random/npcm-rng.c b/drivers/char/hw_random/npcm-rng.c
index 8a304b754217..bce8c4829a1f 100644
--- a/drivers/char/hw_random/npcm-rng.c
+++ b/drivers/char/hw_random/npcm-rng.c
@@ -126,15 +126,13 @@ static int npcm_rng_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int npcm_rng_remove(struct platform_device *pdev)
+static void npcm_rng_remove(struct platform_device *pdev)
 {
 	struct npcm_rng *priv = platform_get_drvdata(pdev);
 
 	devm_hwrng_unregister(&pdev->dev, &priv->rng);
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -178,7 +176,7 @@ static struct platform_driver npcm_rng_driver = {
 		.of_match_table = of_match_ptr(rng_dt_id),
 	},
 	.probe		= npcm_rng_probe,
-	.remove		= npcm_rng_remove,
+	.remove_new	= npcm_rng_remove,
 };
 
 module_platform_driver(npcm_rng_driver);
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 08/12] hwrng: npcm - Convert to platform remove callback returning void
@ 2023-12-10 22:12   ` Uwe Kleine-König
  0 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2023-12-10 22:12 UTC (permalink / raw)
  To: Olivia Mackall, Herbert Xu
  Cc: Benjamin Fair, Avi Fishman, Patrick Venture, openbmc, Tali Perry,
	linux-crypto, kernel, Tomer Maimon

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/npcm-rng.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/char/hw_random/npcm-rng.c b/drivers/char/hw_random/npcm-rng.c
index 8a304b754217..bce8c4829a1f 100644
--- a/drivers/char/hw_random/npcm-rng.c
+++ b/drivers/char/hw_random/npcm-rng.c
@@ -126,15 +126,13 @@ static int npcm_rng_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int npcm_rng_remove(struct platform_device *pdev)
+static void npcm_rng_remove(struct platform_device *pdev)
 {
 	struct npcm_rng *priv = platform_get_drvdata(pdev);
 
 	devm_hwrng_unregister(&pdev->dev, &priv->rng);
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -178,7 +176,7 @@ static struct platform_driver npcm_rng_driver = {
 		.of_match_table = of_match_ptr(rng_dt_id),
 	},
 	.probe		= npcm_rng_probe,
-	.remove		= npcm_rng_remove,
+	.remove_new	= npcm_rng_remove,
 };
 
 module_platform_driver(npcm_rng_driver);
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 09/12] hwrng: omap - Convert to platform remove callback returning void
  2023-12-10 22:12 ` Uwe Kleine-König
                   ` (9 preceding siblings ...)
  (?)
@ 2023-12-10 22:12 ` Uwe Kleine-König
  -1 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2023-12-10 22:12 UTC (permalink / raw)
  To: Olivia Mackall, Herbert Xu; +Cc: Deepak Saxena, linux-crypto, 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/omap-rng.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index be03f76a2a80..d4c02e900466 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -509,7 +509,7 @@ static int omap_rng_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int omap_rng_remove(struct platform_device *pdev)
+static void omap_rng_remove(struct platform_device *pdev)
 {
 	struct omap_rng_dev *priv = platform_get_drvdata(pdev);
 
@@ -521,8 +521,6 @@ static int omap_rng_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(priv->clk);
 	clk_disable_unprepare(priv->clk_reg);
-
-	return 0;
 }
 
 static int __maybe_unused omap_rng_suspend(struct device *dev)
@@ -560,7 +558,7 @@ static struct platform_driver omap_rng_driver = {
 		.of_match_table = of_match_ptr(omap_rng_of_match),
 	},
 	.probe		= omap_rng_probe,
-	.remove		= omap_rng_remove,
+	.remove_new	= omap_rng_remove,
 };
 
 module_platform_driver(omap_rng_driver);
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 10/12] hwrng: stm32 - Convert to platform remove callback returning void
  2023-12-10 22:12 ` Uwe Kleine-König
@ 2023-12-10 22:12   ` Uwe Kleine-König
  -1 siblings, 0 replies; 25+ 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


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 10/12] hwrng: stm32 - Convert to platform remove callback returning void
@ 2023-12-10 22:12   ` Uwe Kleine-König
  0 siblings, 0 replies; 25+ 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] 25+ messages in thread

* [PATCH 11/12] hwrng: timeriomem - Convert to platform remove callback returning void
  2023-12-10 22:12 ` Uwe Kleine-König
                   ` (11 preceding siblings ...)
  (?)
@ 2023-12-10 22:12 ` Uwe Kleine-König
  -1 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2023-12-10 22:12 UTC (permalink / raw)
  To: Olivia Mackall, Herbert Xu
  Cc: Martin Kaiser, Yangtao Li, linux-crypto, 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/timeriomem-rng.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/char/hw_random/timeriomem-rng.c b/drivers/char/hw_random/timeriomem-rng.c
index 3db9d868efb1..65b8260339f5 100644
--- a/drivers/char/hw_random/timeriomem-rng.c
+++ b/drivers/char/hw_random/timeriomem-rng.c
@@ -174,13 +174,11 @@ static int timeriomem_rng_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int timeriomem_rng_remove(struct platform_device *pdev)
+static void timeriomem_rng_remove(struct platform_device *pdev)
 {
 	struct timeriomem_rng_private *priv = platform_get_drvdata(pdev);
 
 	hrtimer_cancel(&priv->timer);
-
-	return 0;
 }
 
 static const struct of_device_id timeriomem_rng_match[] = {
@@ -195,7 +193,7 @@ static struct platform_driver timeriomem_rng_driver = {
 		.of_match_table	= timeriomem_rng_match,
 	},
 	.probe		= timeriomem_rng_probe,
-	.remove		= timeriomem_rng_remove,
+	.remove_new	= timeriomem_rng_remove,
 };
 
 module_platform_driver(timeriomem_rng_driver);
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 12/12] hwrng: xgene - Convert to platform remove callback returning void
  2023-12-10 22:12 ` Uwe Kleine-König
                   ` (12 preceding siblings ...)
  (?)
@ 2023-12-10 22:12 ` Uwe Kleine-König
  -1 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2023-12-10 22:12 UTC (permalink / raw)
  To: Olivia Mackall, Herbert Xu
  Cc: Rob Herring, Yu Zhe, Alexandru Ardelean, Andrei Coardos,
	linux-crypto, 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/xgene-rng.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/char/hw_random/xgene-rng.c b/drivers/char/hw_random/xgene-rng.c
index 7382724bf501..642d13519464 100644
--- a/drivers/char/hw_random/xgene-rng.c
+++ b/drivers/char/hw_random/xgene-rng.c
@@ -357,15 +357,13 @@ static int xgene_rng_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int xgene_rng_remove(struct platform_device *pdev)
+static void xgene_rng_remove(struct platform_device *pdev)
 {
 	int rc;
 
 	rc = device_init_wakeup(&pdev->dev, 0);
 	if (rc)
 		dev_err(&pdev->dev, "RNG init wakeup failed error %d\n", rc);
-
-	return 0;
 }
 
 static const struct of_device_id xgene_rng_of_match[] = {
@@ -377,7 +375,7 @@ MODULE_DEVICE_TABLE(of, xgene_rng_of_match);
 
 static struct platform_driver xgene_rng_driver = {
 	.probe = xgene_rng_probe,
-	.remove	= xgene_rng_remove,
+	.remove_new = xgene_rng_remove,
 	.driver = {
 		.name		= "xgene-rng",
 		.of_match_table = xgene_rng_of_match,
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 01/12] hwrng: atmel - Convert to platform remove callback returning void
  2023-12-10 22:12   ` Uwe Kleine-König
@ 2023-12-11  8:57     ` Nicolas Ferre
  -1 siblings, 0 replies; 25+ 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
> 


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 01/12] hwrng: atmel - Convert to platform remove callback returning void
@ 2023-12-11  8:57     ` Nicolas Ferre
  0 siblings, 0 replies; 25+ 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] 25+ 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; 25+ 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: 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 03/12] hwrng: exynos - Convert to platform remove callback returning void
@ 2023-12-12  9:31       ` Lukasz Stelmach
  0 siblings, 0 replies; 25+ 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] 25+ messages in thread

* Re: [PATCH 00/12] hwrng: Convert to platform remove callback returning
  2023-12-10 22:12 ` Uwe Kleine-König
@ 2023-12-15  9:58   ` Herbert Xu
  -1 siblings, 0 replies; 25+ messages in thread
From: Herbert Xu @ 2023-12-15  9:58 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Olivia Mackall, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	Rob Herring, linux-crypto, linux-arm-kernel, kernel, Hadar Gat,
	Łukasz Stelmach, Krzysztof Kozlowski, Alim Akhtar,
	linux-samsung-soc, Martin Kaiser, Avi Fishman, Tomer Maimon,
	Tali Perry, Patrick Venture, Nancy Yuen, Benjamin Fair, openbmc,
	Deepak Saxena, Maxime Coquelin, Alexandre Torgue,
	Gatien Chevallier, linux-stm32, Yangtao Li, Yu Zhe,
	Alexandru Ardelean, Andrei Coardos

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 00/12] hwrng: Convert to platform remove callback returning
@ 2023-12-15  9:58   ` Herbert Xu
  0 siblings, 0 replies; 25+ 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] 25+ messages in thread

end of thread, other threads:[~2023-12-15  9:59 UTC | newest]

Thread overview: 25+ 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 ` Uwe Kleine-König
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
2023-12-10 22:12   ` Uwe Kleine-König
2023-12-11  8:57   ` Nicolas Ferre
2023-12-11  8:57     ` Nicolas Ferre
2023-12-10 22:12 ` [PATCH 02/12] hwrng: cctrng " 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
     [not found]   ` <CGME20231212093133eucas1p1c19ba5aa058ca1e159bfd070aec0f306@eucas1p1.samsung.com>
2023-12-12  9:31     ` Lukasz Stelmach
2023-12-12  9:31       ` Lukasz Stelmach
2023-12-10 22:12 ` [PATCH 04/12] hwrng: ingenic " Uwe Kleine-König
2023-12-10 22:12 ` [PATCH 05/12] hwrng: ks-sa " Uwe Kleine-König
2023-12-10 22:12 ` [PATCH 06/12] hwrng: mxc " Uwe Kleine-König
2023-12-10 22:12 ` [PATCH 07/12] hwrng: n2 " Uwe Kleine-König
2023-12-10 22:12 ` [PATCH 08/12] hwrng: npcm " Uwe Kleine-König
2023-12-10 22:12   ` Uwe Kleine-König
2023-12-10 22:12 ` [PATCH 09/12] hwrng: omap " Uwe Kleine-König
2023-12-10 22:12 ` [PATCH 10/12] hwrng: stm32 " Uwe Kleine-König
2023-12-10 22:12   ` Uwe Kleine-König
2023-12-10 22:12 ` [PATCH 11/12] hwrng: timeriomem " Uwe Kleine-König
2023-12-10 22:12 ` [PATCH 12/12] hwrng: xgene " Uwe Kleine-König
2023-12-15  9:58 ` [PATCH 00/12] hwrng: Convert to platform remove callback returning Herbert Xu
2023-12-15  9:58   ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.