2024-02-19 11:06:59

by Uwe Kleine-König

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

Hello,

this series converts all drivers below drivers/w1 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 four conversations are trivial, because their .remove() callbacks
returned zero unconditionally.

There are no interdependencies between these patches, so they could be
picked up individually. However I'd expect them to go in all together
via Krzysztof's tree.

Thanks
Uwe

Uwe Kleine-König (4):
w1: mxc_w1: Convert to platform remove callback returning void
w1: omap_hdq: Convert to platform remove callback returning void
w1: sgi_w1: Convert to platform remove callback returning void
w1: w1-gpio: Convert to platform remove callback returning void

drivers/w1/masters/mxc_w1.c | 6 ++----
drivers/w1/masters/omap_hdq.c | 6 ++----
drivers/w1/masters/sgi_w1.c | 6 ++----
drivers/w1/masters/w1-gpio.c | 6 ++----
4 files changed, 8 insertions(+), 16 deletions(-)

base-commit: 35a4fdde2466b9d90af297f249436a270ef9d30e
--
2.43.0



2024-02-19 11:07:21

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 4/4] w1: w1-gpio: 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/w1/masters/w1-gpio.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c
index 05c67038ed20..34128e6bbbfa 100644
--- a/drivers/w1/masters/w1-gpio.c
+++ b/drivers/w1/masters/w1-gpio.c
@@ -141,7 +141,7 @@ static int w1_gpio_probe(struct platform_device *pdev)
return 0;
}

-static int w1_gpio_remove(struct platform_device *pdev)
+static void w1_gpio_remove(struct platform_device *pdev)
{
struct w1_bus_master *master = platform_get_drvdata(pdev);
struct w1_gpio_ddata *ddata = master->data;
@@ -150,8 +150,6 @@ static int w1_gpio_remove(struct platform_device *pdev)
gpiod_set_value(ddata->pullup_gpiod, 0);

w1_remove_master_device(master);
-
- return 0;
}

static struct platform_driver w1_gpio_driver = {
@@ -160,7 +158,7 @@ static struct platform_driver w1_gpio_driver = {
.of_match_table = of_match_ptr(w1_gpio_dt_ids),
},
.probe = w1_gpio_probe,
- .remove = w1_gpio_remove,
+ .remove_new = w1_gpio_remove,
};

module_platform_driver(w1_gpio_driver);
--
2.43.0


2024-02-19 20:25:37

by Uwe Kleine-König

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

Hello,

On Mon, Feb 19, 2024 at 11:59:26AM +0100, Uwe Kleine-K?nig wrote:
> this series converts all drivers below drivers/w1 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 four conversations are trivial, because their .remove() callbacks
> returned zero unconditionally.
>
> There are no interdependencies between these patches, so they could be
> picked up individually. However I'd expect them to go in all together
> via Krzysztof's tree.

This series hit a corner case in my patch sending scripts (because the
maintainer entry title has a ' which I failed to properly quote). I'll
try to resend the patches that didn't hit the mailing list.

Best regards
Uwe

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


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

2024-02-19 20:29:32

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 3/4] w1: sgi_w1: 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/w1/masters/sgi_w1.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/w1/masters/sgi_w1.c b/drivers/w1/masters/sgi_w1.c
index d7fbc3c146e1..7bb7876aa70e 100644
--- a/drivers/w1/masters/sgi_w1.c
+++ b/drivers/w1/masters/sgi_w1.c
@@ -105,13 +105,11 @@ static int sgi_w1_probe(struct platform_device *pdev)
/*
* disassociate the w1 device from the driver
*/
-static int sgi_w1_remove(struct platform_device *pdev)
+static void sgi_w1_remove(struct platform_device *pdev)
{
struct sgi_w1_device *sdev = platform_get_drvdata(pdev);

w1_remove_master_device(&sdev->bus_master);
-
- return 0;
}

static struct platform_driver sgi_w1_driver = {
@@ -119,7 +117,7 @@ static struct platform_driver sgi_w1_driver = {
.name = "sgi_w1",
},
.probe = sgi_w1_probe,
- .remove = sgi_w1_remove,
+ .remove_new = sgi_w1_remove,
};
module_platform_driver(sgi_w1_driver);

--
2.43.0


2024-02-19 20:39:23

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 1/4] w1: mxc_w1: 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/w1/masters/mxc_w1.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c
index 090cbbf9e1e2..ba1d0866d1c4 100644
--- a/drivers/w1/masters/mxc_w1.c
+++ b/drivers/w1/masters/mxc_w1.c
@@ -151,15 +151,13 @@ static int mxc_w1_probe(struct platform_device *pdev)
/*
* disassociate the w1 device from the driver
*/
-static int mxc_w1_remove(struct platform_device *pdev)
+static void mxc_w1_remove(struct platform_device *pdev)
{
struct mxc_w1_device *mdev = platform_get_drvdata(pdev);

w1_remove_master_device(&mdev->bus_master);

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

static const struct of_device_id mxc_w1_dt_ids[] = {
@@ -174,7 +172,7 @@ static struct platform_driver mxc_w1_driver = {
.of_match_table = mxc_w1_dt_ids,
},
.probe = mxc_w1_probe,
- .remove = mxc_w1_remove,
+ .remove_new = mxc_w1_remove,
};
module_platform_driver(mxc_w1_driver);

--
2.43.0


2024-02-20 10:19:40

by Krzysztof Kozlowski

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

On 19/02/2024 21:25, Uwe Kleine-König wrote:
> Hello,
>
> On Mon, Feb 19, 2024 at 11:59:26AM +0100, Uwe Kleine-König wrote:
>> this series converts all drivers below drivers/w1 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 four conversations are trivial, because their .remove() callbacks
>> returned zero unconditionally.
>>
>> There are no interdependencies between these patches, so they could be
>> picked up individually. However I'd expect them to go in all together
>> via Krzysztof's tree.
>
> This series hit a corner case in my patch sending scripts (because the
> maintainer entry title has a ' which I failed to properly quote). I'll
> try to resend the patches that didn't hit the mailing list.

I don't know what you are referring to. I don't think I ever received
your patchset and from another patchset - linked here, but not marked as
resend? - I got only two patches.

Please make a proper submission. Don't attach your patchsets to some
other threads. If this is resend, add proper "RESEND PATCH" prefix.

Best regards,
Krzysztof


2024-02-20 10:46:46

by Krzysztof Kozlowski

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

On 20/02/2024 11:19, Krzysztof Kozlowski wrote:
> On 19/02/2024 21:25, Uwe Kleine-König wrote:
>> Hello,
>>
>> On Mon, Feb 19, 2024 at 11:59:26AM +0100, Uwe Kleine-König wrote:
>>> this series converts all drivers below drivers/w1 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 four conversations are trivial, because their .remove() callbacks
>>> returned zero unconditionally.
>>>
>>> There are no interdependencies between these patches, so they could be
>>> picked up individually. However I'd expect them to go in all together
>>> via Krzysztof's tree.
>>
>> This series hit a corner case in my patch sending scripts (because the
>> maintainer entry title has a ' which I failed to properly quote). I'll
>> try to resend the patches that didn't hit the mailing list.
>
> I don't know what you are referring to. I don't think I ever received
> your patchset and from another patchset - linked here, but not marked as
> resend? - I got only two patches.
>
> Please make a proper submission. Don't attach your patchsets to some
> other threads. If this is resend, add proper "RESEND PATCH" prefix.
>

I think I got the rest of patches here, although this is still oddly
threaded.

Best regards,
Krzysztof


2024-02-20 10:48:25

by Krzysztof Kozlowski

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


On Mon, 19 Feb 2024 11:59:26 +0100, Uwe Kleine-König wrote:
> this series converts all drivers below drivers/w1 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 four conversations are trivial, because their .remove() callbacks
> returned zero unconditionally.
>
> [...]

Applied, thanks!

[1/4] w1: mxc_w1: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-w1/c/63724bbfb1e6b5e202f9393da4b25d4e7a46f5ec
[2/4] w1: omap_hdq: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-w1/c/aa68465cf3d39996b291fb2080946c2e4d7cc100
[3/4] w1: sgi_w1: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-w1/c/d7516044f167b219dae13010e6ff790e3fc96ef5
[4/4] w1: w1-gpio: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-w1/c/d97d263132a69a0bda54efce3df04e55fa6341f7

Best regards,
--
Krzysztof Kozlowski <[email protected]>