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.
Best regards
Uwe
Uwe Kleine-König (11):
misc: atmel-ssc: Convert to platform remove callback returning void
cxl: Convert to platform remove callback returning void
misc: fastrpc: Convert to platform remove callback returning void
misc: hisi_hikey_usb: Convert to platform remove callback returning
void
mei: vsc: Convert to platform remove callback returning void
misc: open-dice: Convert to platform remove callback returning void
misc: sram: Convert to platform remove callback returning void
misc: ti-st: st_kim: Convert to platform remove callback returning
void
misc: vcpu_stall_detector: Convert to platform remove callback
returning void
misc: xilinx_sdfec: Convert to platform remove callback returning void
misc: xilinx_tmr_inject: Convert to platform remove callback returning
void
drivers/misc/atmel-ssc.c | 6 ++----
drivers/misc/cxl/of.c | 5 ++---
drivers/misc/fastrpc.c | 6 ++----
drivers/misc/hisi_hikey_usb.c | 6 ++----
drivers/misc/mei/platform-vsc.c | 6 ++----
drivers/misc/open-dice.c | 5 ++---
drivers/misc/sram.c | 6 ++----
drivers/misc/ti-st/st_kim.c | 5 ++---
drivers/misc/vcpu_stall_detector.c | 6 ++----
drivers/misc/xilinx_sdfec.c | 5 ++---
drivers/misc/xilinx_tmr_inject.c | 5 ++---
11 files changed, 22 insertions(+), 39 deletions(-)
base-commit: 4893c639cc3659cefaa675bf1e59f4e7571afb5c
--
2.43.0
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 <[email protected]>
---
drivers/misc/hisi_hikey_usb.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/hisi_hikey_usb.c b/drivers/misc/hisi_hikey_usb.c
index 2165ec35a343..8f55db8938e6 100644
--- a/drivers/misc/hisi_hikey_usb.c
+++ b/drivers/misc/hisi_hikey_usb.c
@@ -239,7 +239,7 @@ static int hisi_hikey_usb_probe(struct platform_device *pdev)
return 0;
}
-static int hisi_hikey_usb_remove(struct platform_device *pdev)
+static void hisi_hikey_usb_remove(struct platform_device *pdev)
{
struct hisi_hikey_usb *hisi_hikey_usb = platform_get_drvdata(pdev);
@@ -251,8 +251,6 @@ static int hisi_hikey_usb_remove(struct platform_device *pdev)
} else {
hub_power_ctrl(hisi_hikey_usb, HUB_VBUS_POWER_OFF);
}
-
- return 0;
}
static const struct of_device_id id_table_hisi_hikey_usb[] = {
@@ -263,7 +261,7 @@ MODULE_DEVICE_TABLE(of, id_table_hisi_hikey_usb);
static struct platform_driver hisi_hikey_usb_driver = {
.probe = hisi_hikey_usb_probe,
- .remove = hisi_hikey_usb_remove,
+ .remove_new = hisi_hikey_usb_remove,
.driver = {
.name = DEVICE_DRIVER_NAME,
.of_match_table = id_table_hisi_hikey_usb,
--
2.43.0
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 <[email protected]>
---
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
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 <[email protected]>
---
drivers/misc/cxl/of.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/cxl/of.c b/drivers/misc/cxl/of.c
index 25ce725035e7..bcc005dff1c0 100644
--- a/drivers/misc/cxl/of.c
+++ b/drivers/misc/cxl/of.c
@@ -431,7 +431,7 @@ int cxl_of_read_adapter_properties(struct cxl *adapter, struct device_node *np)
return 0;
}
-static int cxl_of_remove(struct platform_device *pdev)
+static void cxl_of_remove(struct platform_device *pdev)
{
struct cxl *adapter;
int afu;
@@ -441,7 +441,6 @@ static int cxl_of_remove(struct platform_device *pdev)
cxl_guest_remove_afu(adapter->afu[afu]);
cxl_guest_remove_adapter(adapter);
- return 0;
}
static void cxl_of_shutdown(struct platform_device *pdev)
@@ -501,6 +500,6 @@ struct platform_driver cxl_of_driver = {
.owner = THIS_MODULE
},
.probe = cxl_of_probe,
- .remove = cxl_of_remove,
+ .remove_new = cxl_of_remove,
.shutdown = cxl_of_shutdown,
};
--
2.43.0
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 <[email protected]>
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 <[email protected]>
Acked-by: Nicolas Ferre <[email protected]>
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
>
On Wed, Feb 21, 2024 at 1:54 AM Uwe Kleine-König
<[email protected]> 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 <[email protected]>
Looks fine to me.
Acked-by: John Stultz <[email protected]>
CC'ing YongQin as he still has hardware to test with.
thanks
-john
On Wed, 2024-02-21 at 10:53 +0100, 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 <[email protected]>
Acked-by: Andrew Donnellan <[email protected]>
> ---
> drivers/misc/cxl/of.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/misc/cxl/of.c b/drivers/misc/cxl/of.c
> index 25ce725035e7..bcc005dff1c0 100644
> --- a/drivers/misc/cxl/of.c
> +++ b/drivers/misc/cxl/of.c
> @@ -431,7 +431,7 @@ int cxl_of_read_adapter_properties(struct cxl
> *adapter, struct device_node *np)
> return 0;
> }
>
> -static int cxl_of_remove(struct platform_device *pdev)
> +static void cxl_of_remove(struct platform_device *pdev)
> {
> struct cxl *adapter;
> int afu;
> @@ -441,7 +441,6 @@ static int cxl_of_remove(struct platform_device
> *pdev)
> cxl_guest_remove_afu(adapter->afu[afu]);
>
> cxl_guest_remove_adapter(adapter);
> - return 0;
> }
>
> static void cxl_of_shutdown(struct platform_device *pdev)
> @@ -501,6 +500,6 @@ struct platform_driver cxl_of_driver = {
> .owner = THIS_MODULE
> },
> .probe = cxl_of_probe,
> - .remove = cxl_of_remove,
> + .remove_new = cxl_of_remove,
> .shutdown = cxl_of_shutdown,
> };
--
Andrew Donnellan OzLabs, ADL Canberra
[email protected] IBM Australia Limited
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 <[email protected]>
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/ |
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 <[email protected]>
>
> 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...