* [PATCH 01/11] misc: atmel-ssc: Convert to platform remove callback returning void
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
@ 2024-02-21 9:53 ` Uwe Kleine-König
2024-02-21 13:49 ` Nicolas.Ferre
2024-02-21 9:53 ` [PATCH 10/11] misc: xilinx_sdfec: " Uwe Kleine-König
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2024-02-21 9:53 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman
Cc: Alexandre Belloni, linux-kernel, Claudiu Beznea, kernel,
linux-arm-kernel
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/misc/atmel-ssc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index ee590c4a1537..6eac0f335915 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -251,7 +251,7 @@ static int ssc_probe(struct platform_device *pdev)
return 0;
}
-static int ssc_remove(struct platform_device *pdev)
+static void ssc_remove(struct platform_device *pdev)
{
struct ssc_device *ssc = platform_get_drvdata(pdev);
@@ -260,8 +260,6 @@ static int ssc_remove(struct platform_device *pdev)
mutex_lock(&user_lock);
list_del(&ssc->list);
mutex_unlock(&user_lock);
-
- return 0;
}
static struct platform_driver ssc_driver = {
@@ -271,7 +269,7 @@ static struct platform_driver ssc_driver = {
},
.id_table = atmel_ssc_devtypes,
.probe = ssc_probe,
- .remove = ssc_remove,
+ .remove_new = ssc_remove,
};
module_platform_driver(ssc_driver);
--
2.43.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] 8+ messages in thread* Re: [PATCH 01/11] misc: atmel-ssc: Convert to platform remove callback returning void
2024-02-21 9:53 ` [PATCH 01/11] misc: atmel-ssc: " Uwe Kleine-König
@ 2024-02-21 13:49 ` Nicolas.Ferre
0 siblings, 0 replies; 8+ messages in thread
From: Nicolas.Ferre @ 2024-02-21 13:49 UTC (permalink / raw)
To: u.kleine-koenig, arnd, gregkh
Cc: kernel, claudiu.beznea, alexandre.belloni, linux-arm-kernel,
linux-kernel
On 21/02/2024 at 10:53, 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>
Thanks Uwe.
> ---
> drivers/misc/atmel-ssc.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
> index ee590c4a1537..6eac0f335915 100644
> --- a/drivers/misc/atmel-ssc.c
> +++ b/drivers/misc/atmel-ssc.c
> @@ -251,7 +251,7 @@ static int ssc_probe(struct platform_device *pdev)
> return 0;
> }
>
> -static int ssc_remove(struct platform_device *pdev)
> +static void ssc_remove(struct platform_device *pdev)
> {
> struct ssc_device *ssc = platform_get_drvdata(pdev);
>
> @@ -260,8 +260,6 @@ static int ssc_remove(struct platform_device *pdev)
> mutex_lock(&user_lock);
> list_del(&ssc->list);
> mutex_unlock(&user_lock);
> -
> - return 0;
> }
>
> static struct platform_driver ssc_driver = {
> @@ -271,7 +269,7 @@ static struct platform_driver ssc_driver = {
> },
> .id_table = atmel_ssc_devtypes,
> .probe = ssc_probe,
> - .remove = ssc_remove,
> + .remove_new = ssc_remove,
> };
> module_platform_driver(ssc_driver);
>
> --
> 2.43.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] 8+ messages in thread
* [PATCH 10/11] misc: xilinx_sdfec: Convert to platform remove callback returning void
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 01/11] misc: atmel-ssc: " Uwe Kleine-König
@ 2024-02-21 9:53 ` Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 11/11] misc: xilinx_tmr_inject: " Uwe Kleine-König
2024-02-21 13:52 ` [PATCH 00/11] misc: " Arnd Bergmann
3 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2024-02-21 9:53 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman
Cc: kernel, Derek Kiernan, Dragan Cvetic, Michal Simek,
linux-arm-kernel, linux-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/misc/xilinx_sdfec.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c
index 94a0ee19bf20..ea433695f4c4 100644
--- a/drivers/misc/xilinx_sdfec.c
+++ b/drivers/misc/xilinx_sdfec.c
@@ -1420,7 +1420,7 @@ static int xsdfec_probe(struct platform_device *pdev)
return err;
}
-static int xsdfec_remove(struct platform_device *pdev)
+static void xsdfec_remove(struct platform_device *pdev)
{
struct xsdfec_dev *xsdfec;
@@ -1428,7 +1428,6 @@ static int xsdfec_remove(struct platform_device *pdev)
misc_deregister(&xsdfec->miscdev);
ida_free(&dev_nrs, xsdfec->dev_id);
xsdfec_disable_all_clks(&xsdfec->clks);
- return 0;
}
static const struct of_device_id xsdfec_of_match[] = {
@@ -1445,7 +1444,7 @@ static struct platform_driver xsdfec_driver = {
.of_match_table = xsdfec_of_match,
},
.probe = xsdfec_probe,
- .remove = xsdfec_remove,
+ .remove_new = xsdfec_remove,
};
module_platform_driver(xsdfec_driver);
--
2.43.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] 8+ messages in thread* [PATCH 11/11] misc: xilinx_tmr_inject: Convert to platform remove callback returning void
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 01/11] misc: atmel-ssc: " Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 10/11] misc: xilinx_sdfec: " Uwe Kleine-König
@ 2024-02-21 9:53 ` Uwe Kleine-König
2024-02-21 13:52 ` [PATCH 00/11] misc: " Arnd Bergmann
3 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2024-02-21 9:53 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman
Cc: kernel, Appana Durga Kedareswara rao, Michal Simek,
linux-arm-kernel, linux-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/misc/xilinx_tmr_inject.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/xilinx_tmr_inject.c b/drivers/misc/xilinx_tmr_inject.c
index 9fc5835bfebc..73c6da7d0963 100644
--- a/drivers/misc/xilinx_tmr_inject.c
+++ b/drivers/misc/xilinx_tmr_inject.c
@@ -143,11 +143,10 @@ static int xtmr_inject_probe(struct platform_device *pdev)
return 0;
}
-static int xtmr_inject_remove(struct platform_device *pdev)
+static void xtmr_inject_remove(struct platform_device *pdev)
{
debugfs_remove_recursive(dbgfs_root);
dbgfs_root = NULL;
- return 0;
}
static const struct of_device_id xtmr_inject_of_match[] = {
@@ -164,7 +163,7 @@ static struct platform_driver xtmr_inject_driver = {
.of_match_table = xtmr_inject_of_match,
},
.probe = xtmr_inject_probe,
- .remove = xtmr_inject_remove,
+ .remove_new = xtmr_inject_remove,
};
module_platform_driver(xtmr_inject_driver);
MODULE_AUTHOR("Advanced Micro Devices, Inc");
--
2.43.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] 8+ messages in thread* Re: [PATCH 00/11] misc: Convert to platform remove callback returning void
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
` (2 preceding siblings ...)
2024-02-21 9:53 ` [PATCH 11/11] misc: xilinx_tmr_inject: " Uwe Kleine-König
@ 2024-02-21 13:52 ` Arnd Bergmann
2024-03-04 22:36 ` Uwe Kleine-König
3 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2024-02-21 13:52 UTC (permalink / raw)
To: Uwe Kleine-König, Greg Kroah-Hartman
Cc: Alexandre Belloni, derek.kiernan@amd.com, Andrew Donnellan,
Jiri Slaby, linux-arm-msm, linux-kernel, Claudiu Beznea,
Michal Simek, Srinivas Kandagatla, dragan.cvetic@amd.com,
Pengutronix Kernel Team, Justin Stitt, Frederic Barrat,
John Stultz, Tomas Winkler, Amol Maheshwari, linuxppc-dev,
Appana Durga Kedareswara rao, linux-arm-kernel, Kees Cook
On Wed, Feb 21, 2024, at 10:53, Uwe Kleine-König wrote:
> Hello,
>
> this series converts all drivers below drivers/misc to struct
> platform_driver::remove_new(). See commit 5c5a7680e67b ("platform:
> Provide a remove callback that returns no value") for an extended
> explanation and the eventual goal.
>
> All conversations are trivial, because their .remove() callbacks
> returned zero unconditionally.
>
> There are no interdependencies between these patches, so they could be
> picked up individually. But I'd hope that Greg or Arnd picks them up all
> together.
These all look good to me, whole series
Acked-by: Arnd Bergmann <arnd@arndb.de>
_______________________________________________
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] 8+ messages in thread* Re: [PATCH 00/11] misc: Convert to platform remove callback returning void
2024-02-21 13:52 ` [PATCH 00/11] misc: " Arnd Bergmann
@ 2024-03-04 22:36 ` Uwe Kleine-König
2024-03-04 23:42 ` Greg Kroah-Hartman
0 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2024-03-04 22:36 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman
Cc: Alexandre Belloni, derek.kiernan@amd.com, Kees Cook,
linux-arm-msm, linuxppc-dev, linux-kernel, Claudiu Beznea,
John Stultz, Michal Simek, dragan.cvetic@amd.com,
Pengutronix Kernel Team, Justin Stitt, Frederic Barrat,
Srinivas Kandagatla, Tomas Winkler, Amol Maheshwari, Jiri Slaby,
Appana Durga Kedareswara rao, linux-arm-kernel, Andrew Donnellan
[-- Attachment #1.1: Type: text/plain, Size: 1128 bytes --]
Hello Arnd, hello Greg,
On Wed, Feb 21, 2024 at 02:52:29PM +0100, Arnd Bergmann wrote:
> On Wed, Feb 21, 2024, at 10:53, Uwe Kleine-König wrote:
> > Hello,
> >
> > this series converts all drivers below drivers/misc to struct
> > platform_driver::remove_new(). See commit 5c5a7680e67b ("platform:
> > Provide a remove callback that returns no value") for an extended
> > explanation and the eventual goal.
> >
> > All conversations are trivial, because their .remove() callbacks
> > returned zero unconditionally.
> >
> > There are no interdependencies between these patches, so they could be
> > picked up individually. But I'd hope that Greg or Arnd picks them up all
> > together.
>
> These all look good to me, whole series
>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
Thanks.
You (= Arnd and Greg) are the listed maintainers for drivers/misc/. How
is this series supposed to be merged? Would a pull request help?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 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] 8+ messages in thread* Re: [PATCH 00/11] misc: Convert to platform remove callback returning void
2024-03-04 22:36 ` Uwe Kleine-König
@ 2024-03-04 23:42 ` Greg Kroah-Hartman
0 siblings, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2024-03-04 23:42 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Arnd Bergmann, Alexandre Belloni, derek.kiernan@amd.com,
Kees Cook, linux-arm-msm, linuxppc-dev, linux-kernel,
Claudiu Beznea, John Stultz, Michal Simek, dragan.cvetic@amd.com,
Pengutronix Kernel Team, Justin Stitt, Frederic Barrat,
Srinivas Kandagatla, Tomas Winkler, Amol Maheshwari, Jiri Slaby,
Appana Durga Kedareswara rao, linux-arm-kernel, Andrew Donnellan
On Mon, Mar 04, 2024 at 11:36:23PM +0100, Uwe Kleine-König wrote:
> Hello Arnd, hello Greg,
>
> On Wed, Feb 21, 2024 at 02:52:29PM +0100, Arnd Bergmann wrote:
> > On Wed, Feb 21, 2024, at 10:53, Uwe Kleine-König wrote:
> > > Hello,
> > >
> > > this series converts all drivers below drivers/misc to struct
> > > platform_driver::remove_new(). See commit 5c5a7680e67b ("platform:
> > > Provide a remove callback that returns no value") for an extended
> > > explanation and the eventual goal.
> > >
> > > All conversations are trivial, because their .remove() callbacks
> > > returned zero unconditionally.
> > >
> > > There are no interdependencies between these patches, so they could be
> > > picked up individually. But I'd hope that Greg or Arnd picks them up all
> > > together.
> >
> > These all look good to me, whole series
> >
> > Acked-by: Arnd Bergmann <arnd@arndb.de>
>
> Thanks.
>
> You (= Arnd and Greg) are the listed maintainers for drivers/misc/. How
> is this series supposed to be merged? Would a pull request help?
I can take the patchset, let me catch up...
_______________________________________________
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] 8+ messages in thread