All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] w1: Convert to platform remove callback returning void
@ 2024-02-19 10:59 Uwe Kleine-König
  2024-02-19 10:59 ` [PATCH 2/4] w1: omap_hdq: " Uwe Kleine-König
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2024-02-19 10:59 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: kernel, Greg Kroah-Hartman, linux-kernel, Rob Herring

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


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

* [PATCH 2/4] w1: omap_hdq: Convert to platform remove callback returning void
  2024-02-19 10:59 [PATCH 0/4] w1: Convert to platform remove callback returning void Uwe Kleine-König
@ 2024-02-19 10:59 ` Uwe Kleine-König
  2024-02-19 10:59 ` [PATCH 4/4] w1: w1-gpio: " Uwe Kleine-König
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2024-02-19 10:59 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: kernel, Greg Kroah-Hartman, 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/w1/masters/omap_hdq.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c
index 6a39b71eb718..d1cb5190445a 100644
--- a/drivers/w1/masters/omap_hdq.c
+++ b/drivers/w1/masters/omap_hdq.c
@@ -647,7 +647,7 @@ static int omap_hdq_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int omap_hdq_remove(struct platform_device *pdev)
+static void omap_hdq_remove(struct platform_device *pdev)
 {
 	int active;
 
@@ -661,8 +661,6 @@ static int omap_hdq_remove(struct platform_device *pdev)
 	if (active >= 0)
 		pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 static const struct of_device_id omap_hdq_dt_ids[] = {
@@ -674,7 +672,7 @@ MODULE_DEVICE_TABLE(of, omap_hdq_dt_ids);
 
 static struct platform_driver omap_hdq_driver = {
 	.probe = omap_hdq_probe,
-	.remove = omap_hdq_remove,
+	.remove_new = omap_hdq_remove,
 	.driver = {
 		.name =	"omap_hdq",
 		.of_match_table = omap_hdq_dt_ids,
-- 
2.43.0


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

* [PATCH 4/4] w1: w1-gpio: Convert to platform remove callback returning void
  2024-02-19 10:59 [PATCH 0/4] w1: Convert to platform remove callback returning void Uwe Kleine-König
  2024-02-19 10:59 ` [PATCH 2/4] w1: omap_hdq: " Uwe Kleine-König
@ 2024-02-19 10:59 ` Uwe Kleine-König
  2024-02-19 20:25 ` [PATCH 0/4] w1: " Uwe Kleine-König
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2024-02-19 10:59 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: kernel, Rob Herring, Greg Kroah-Hartman, 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/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


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

* Re: [PATCH 0/4] w1: Convert to platform remove callback returning void
  2024-02-19 10:59 [PATCH 0/4] w1: Convert to platform remove callback returning void Uwe Kleine-König
  2024-02-19 10:59 ` [PATCH 2/4] w1: omap_hdq: " Uwe Kleine-König
  2024-02-19 10:59 ` [PATCH 4/4] w1: w1-gpio: " Uwe Kleine-König
@ 2024-02-19 20:25 ` Uwe Kleine-König
  2024-02-20 10:19   ` Krzysztof Kozlowski
  2024-02-19 20:28 ` [PATCH 1/4] w1: mxc_w1: " Uwe Kleine-König
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2024-02-19 20:25 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Greg Kroah-Hartman, linux-kernel, kernel, Rob Herring

[-- Attachment #1: Type: text/plain, Size: 992 bytes --]

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/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* [PATCH 1/4] w1: mxc_w1: Convert to platform remove callback returning void
  2024-02-19 10:59 [PATCH 0/4] w1: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (2 preceding siblings ...)
  2024-02-19 20:25 ` [PATCH 0/4] w1: " Uwe Kleine-König
@ 2024-02-19 20:28 ` Uwe Kleine-König
  2024-02-19 20:28 ` [PATCH 3/4] w1: sgi_w1: " Uwe Kleine-König
  2024-02-20 10:25 ` [PATCH 0/4] w1: " Krzysztof Kozlowski
  5 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2024-02-19 20:28 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: 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/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


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

* [PATCH 3/4] w1: sgi_w1: Convert to platform remove callback returning void
  2024-02-19 10:59 [PATCH 0/4] w1: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (3 preceding siblings ...)
  2024-02-19 20:28 ` [PATCH 1/4] w1: mxc_w1: " Uwe Kleine-König
@ 2024-02-19 20:28 ` Uwe Kleine-König
  2024-02-20 10:25 ` [PATCH 0/4] w1: " Krzysztof Kozlowski
  5 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2024-02-19 20:28 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: 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/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


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

* Re: [PATCH 0/4] w1: Convert to platform remove callback returning void
  2024-02-19 20:25 ` [PATCH 0/4] w1: " Uwe Kleine-König
@ 2024-02-20 10:19   ` Krzysztof Kozlowski
  2024-02-20 10:21     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 9+ messages in thread
From: Krzysztof Kozlowski @ 2024-02-20 10:19 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Greg Kroah-Hartman, linux-kernel, kernel, Rob Herring

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


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

* Re: [PATCH 0/4] w1: Convert to platform remove callback returning void
  2024-02-20 10:19   ` Krzysztof Kozlowski
@ 2024-02-20 10:21     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2024-02-20 10:21 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Greg Kroah-Hartman, linux-kernel, kernel, Rob Herring

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


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

* Re: [PATCH 0/4] w1: Convert to platform remove callback returning void
  2024-02-19 10:59 [PATCH 0/4] w1: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (4 preceding siblings ...)
  2024-02-19 20:28 ` [PATCH 3/4] w1: sgi_w1: " Uwe Kleine-König
@ 2024-02-20 10:25 ` Krzysztof Kozlowski
  5 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2024-02-20 10:25 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: kernel, Greg Kroah-Hartman, linux-kernel, Rob Herring


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 <krzysztof.kozlowski@linaro.org>


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

end of thread, other threads:[~2024-02-20 10:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-19 10:59 [PATCH 0/4] w1: Convert to platform remove callback returning void Uwe Kleine-König
2024-02-19 10:59 ` [PATCH 2/4] w1: omap_hdq: " Uwe Kleine-König
2024-02-19 10:59 ` [PATCH 4/4] w1: w1-gpio: " Uwe Kleine-König
2024-02-19 20:25 ` [PATCH 0/4] w1: " Uwe Kleine-König
2024-02-20 10:19   ` Krzysztof Kozlowski
2024-02-20 10:21     ` Krzysztof Kozlowski
2024-02-19 20:28 ` [PATCH 1/4] w1: mxc_w1: " Uwe Kleine-König
2024-02-19 20:28 ` [PATCH 3/4] w1: sgi_w1: " Uwe Kleine-König
2024-02-20 10:25 ` [PATCH 0/4] w1: " Krzysztof Kozlowski

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.