2024-03-05 21:33:39

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 0/3] reset: Convert to platform remove callback returning void

Hello,

this series converts all platform drivers below drivers/reset 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 they get picked up all
together by Philipp.

Best regards
Uwe

Uwe Kleine-König (3):
reset: meson-audio-arb: Convert to platform remove callback returning void
reset: rzg2l-usbphy-ctrl: Convert to platform remove callback returning void
reset: ti-sci: Convert to platform remove callback returning void

drivers/reset/reset-meson-audio-arb.c | 6 ++----
drivers/reset/reset-rzg2l-usbphy-ctrl.c | 6 ++----
drivers/reset/reset-ti-sci.c | 6 ++----
3 files changed, 6 insertions(+), 12 deletions(-)

base-commit: 11afac187274a6177a7ac82997f8691c0f469e41
--
2.43.0



2024-03-05 21:33:52

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 1/3] reset: meson-audio-arb: Convert to platform remove callback returning void

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/reset/reset-meson-audio-arb.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/reset/reset-meson-audio-arb.c b/drivers/reset/reset-meson-audio-arb.c
index 7891d52fa899..8740f5f6abf8 100644
--- a/drivers/reset/reset-meson-audio-arb.c
+++ b/drivers/reset/reset-meson-audio-arb.c
@@ -120,7 +120,7 @@ static const struct of_device_id meson_audio_arb_of_match[] = {
};
MODULE_DEVICE_TABLE(of, meson_audio_arb_of_match);

-static int meson_audio_arb_remove(struct platform_device *pdev)
+static void meson_audio_arb_remove(struct platform_device *pdev)
{
struct meson_audio_arb_data *arb = platform_get_drvdata(pdev);

@@ -130,8 +130,6 @@ static int meson_audio_arb_remove(struct platform_device *pdev)
spin_unlock(&arb->lock);

clk_disable_unprepare(arb->clk);
-
- return 0;
}

static int meson_audio_arb_probe(struct platform_device *pdev)
@@ -189,7 +187,7 @@ static int meson_audio_arb_probe(struct platform_device *pdev)

static struct platform_driver meson_audio_arb_pdrv = {
.probe = meson_audio_arb_probe,
- .remove = meson_audio_arb_remove,
+ .remove_new = meson_audio_arb_remove,
.driver = {
.name = "meson-audio-arb-reset",
.of_match_table = meson_audio_arb_of_match,
--
2.43.0


2024-03-12 08:47:45

by Philipp Zabel

[permalink] [raw]
Subject: Re: [PATCH 0/3] reset: Convert to platform remove callback returning void

On Di, 2024-03-05 at 22:32 +0100, Uwe Kleine-König wrote:
> Hello,
>
> this series converts all platform drivers below drivers/reset 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 they get picked up all
> together by Philipp.

Thank you, I'll pick them up.

Reviewed-by: Philipp Zabel <[email protected]>

regards
Philipp

2024-05-25 10:15:01

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH 0/3] reset: Convert to platform remove callback returning void

Hello Philipp,

On Tue, Mar 12, 2024 at 09:47:24AM +0100, Philipp Zabel wrote:
> On Di, 2024-03-05 at 22:32 +0100, Uwe Kleine-K?nig wrote:
> > this series converts all platform drivers below drivers/reset 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 they get picked up all
> > together by Philipp.
>
> Thank you, I'll pick them up.
>
> Reviewed-by: Philipp Zabel <[email protected]>

These patches made it into next (as v6.9-rc1..6d89df61650d), but not yet
into Linus's tree for v6.10-rc1. I intend to send a PR to Greg early
next week changing platform_driver::remove to match remove_new to cook
long in next for v6.11-rc1. If these reset commits don't make it in in time,
I'll be so bold and just include the commits from your for-next branch
in my PR.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | https://www.pengutronix.de/ |


Attachments:
(No filename) (1.32 kB)
signature.asc (499.00 B)
Download all attachments

2024-05-27 07:24:12

by Philipp Zabel

[permalink] [raw]
Subject: Re: [PATCH 0/3] reset: Convert to platform remove callback returning void

Hi Uwe,

On Sa, 2024-05-25 at 12:14 +0200, Uwe Kleine-König wrote:
> Hello Philipp,
>
> On Tue, Mar 12, 2024 at 09:47:24AM +0100, Philipp Zabel wrote:
> > On Di, 2024-03-05 at 22:32 +0100, Uwe Kleine-König wrote:
> > > this series converts all platform drivers below drivers/reset 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 they get picked up all
> > > together by Philipp.
> >
> > Thank you, I'll pick them up.
> >
> > Reviewed-by: Philipp Zabel <[email protected]>
>
> These patches made it into next (as v6.9-rc1..6d89df61650d), but not yet
> into Linus's tree for v6.10-rc1. I intend to send a PR to Greg early next week changing
> platform_driver::remove to match remove_new to cook
> long in next for v6.11-rc1. If these reset commits don't make it in in time,
> I'll be so bold and just include the commits from your for-next branch
> in my PR.

Please do, thank you.

Acked-by: Philipp Zabel <[email protected]>

regards
Philipp