* [PATCH 0/7] extcon: Convert to platform remove callback returning void
@ 2024-02-25 15:54 ` Uwe Kleine-König
2024-02-25 15:54 ` [PATCH 7/7] extcon: usbc-cros-ec: " Uwe Kleine-König
2024-03-07 11:34 ` [PATCH 0/7] extcon: " Chanwoo Choi
0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2024-02-25 15:54 UTC (permalink / raw)
To: MyungJoo Ham, Chanwoo Choi
Cc: linux-kernel, Krzysztof Kozlowski, Benson Leung, Guenter Roeck,
chrome-platform
Hello,
this series converts all drivers below drivers/extcon 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 the extcon maintainer team.
Best regards
Uwe
Uwe Kleine-König (7):
extcon: adc-jack: Convert to platform remove callback returning void
extcon: intel-cht-wc: Convert to platform remove callback returning void
extcon: intel-mrfld: Convert to platform remove callback returning void
extcon: max3355: Convert to platform remove callback returning void
extcon: max77843: Convert to platform remove callback returning void
extcon: usb-gpio: Convert to platform remove callback returning void
extcon: usbc-cros-ec: Convert to platform remove callback returning void
drivers/extcon/extcon-adc-jack.c | 6 ++----
drivers/extcon/extcon-intel-cht-wc.c | 6 ++----
drivers/extcon/extcon-intel-mrfld.c | 6 ++----
drivers/extcon/extcon-max3355.c | 6 ++----
drivers/extcon/extcon-max77843.c | 6 ++----
drivers/extcon/extcon-usb-gpio.c | 6 ++----
drivers/extcon/extcon-usbc-cros-ec.c | 6 ++----
7 files changed, 14 insertions(+), 28 deletions(-)
base-commit: 33e1d31873f87d119e5120b88cd350efa68ef276
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 7/7] extcon: usbc-cros-ec: Convert to platform remove callback returning void
2024-02-25 15:54 ` [PATCH 0/7] extcon: Convert to platform remove callback returning void Uwe Kleine-König
@ 2024-02-25 15:54 ` Uwe Kleine-König
2024-02-26 5:48 ` Tzung-Bi Shih
2024-03-07 11:34 ` [PATCH 0/7] extcon: " Chanwoo Choi
1 sibling, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2024-02-25 15:54 UTC (permalink / raw)
To: MyungJoo Ham, Chanwoo Choi
Cc: Benson Leung, Guenter Roeck, linux-kernel, chrome-platform
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/extcon/extcon-usbc-cros-ec.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/extcon/extcon-usbc-cros-ec.c b/drivers/extcon/extcon-usbc-cros-ec.c
index fde1db62be0d..805a47230689 100644
--- a/drivers/extcon/extcon-usbc-cros-ec.c
+++ b/drivers/extcon/extcon-usbc-cros-ec.c
@@ -480,14 +480,12 @@ static int extcon_cros_ec_probe(struct platform_device *pdev)
return ret;
}
-static int extcon_cros_ec_remove(struct platform_device *pdev)
+static void extcon_cros_ec_remove(struct platform_device *pdev)
{
struct cros_ec_extcon_info *info = platform_get_drvdata(pdev);
blocking_notifier_chain_unregister(&info->ec->event_notifier,
&info->notifier);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -531,7 +529,7 @@ static struct platform_driver extcon_cros_ec_driver = {
.of_match_table = of_match_ptr(extcon_cros_ec_of_match),
.pm = DEV_PM_OPS,
},
- .remove = extcon_cros_ec_remove,
+ .remove_new = extcon_cros_ec_remove,
.probe = extcon_cros_ec_probe,
};
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 7/7] extcon: usbc-cros-ec: Convert to platform remove callback returning void
2024-02-25 15:54 ` [PATCH 7/7] extcon: usbc-cros-ec: " Uwe Kleine-König
@ 2024-02-26 5:48 ` Tzung-Bi Shih
0 siblings, 0 replies; 4+ messages in thread
From: Tzung-Bi Shih @ 2024-02-26 5:48 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: MyungJoo Ham, Chanwoo Choi, Benson Leung, Guenter Roeck,
linux-kernel, chrome-platform
On Sun, Feb 25, 2024 at 04:54:56PM +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 <u.kleine-koenig@pengutronix.de>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH 0/7] extcon: Convert to platform remove callback returning void
2024-02-25 15:54 ` [PATCH 0/7] extcon: Convert to platform remove callback returning void Uwe Kleine-König
2024-02-25 15:54 ` [PATCH 7/7] extcon: usbc-cros-ec: " Uwe Kleine-König
@ 2024-03-07 11:34 ` Chanwoo Choi
1 sibling, 0 replies; 4+ messages in thread
From: Chanwoo Choi @ 2024-03-07 11:34 UTC (permalink / raw)
To: 'Uwe Kleine-König', 'MyungJoo Ham'
Cc: linux-kernel, 'Krzysztof Kozlowski',
'Benson Leung', 'Guenter Roeck', chrome-platform
> -----Original Message-----
> From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Sent: Monday, February 26, 2024 12:55 AM
> To: MyungJoo Ham <myungjoo.ham@samsung.com>; Chanwoo Choi
> <cw00.choi@samsung.com>
> Cc: linux-kernel@vger.kernel.org; Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org>; Benson Leung <bleung@chromium.org>; Guenter
> Roeck <groeck@chromium.org>; chrome-platform@lists.linux.dev
> Subject: [PATCH 0/7] extcon: Convert to platform remove callback returning
> void
>
> Hello,
>
> this series converts all drivers below drivers/extcon 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 the
> extcon maintainer team.
>
> Best regards
> Uwe
>
> Uwe Kleine-König (7):
> extcon: adc-jack: Convert to platform remove callback returning void
> extcon: intel-cht-wc: Convert to platform remove callback returning void
> extcon: intel-mrfld: Convert to platform remove callback returning void
> extcon: max3355: Convert to platform remove callback returning void
> extcon: max77843: Convert to platform remove callback returning void
> extcon: usb-gpio: Convert to platform remove callback returning void
> extcon: usbc-cros-ec: Convert to platform remove callback returning void
>
> drivers/extcon/extcon-adc-jack.c | 6 ++----
> drivers/extcon/extcon-intel-cht-wc.c | 6 ++---- drivers/extcon/extcon-
> intel-mrfld.c | 6 ++----
> drivers/extcon/extcon-max3355.c | 6 ++----
> drivers/extcon/extcon-max77843.c | 6 ++----
> drivers/extcon/extcon-usb-gpio.c | 6 ++----
> drivers/extcon/extcon-usbc-cros-ec.c | 6 ++----
> 7 files changed, 14 insertions(+), 28 deletions(-)
>
Applied them. Thanks.
Best Regards,
Chanwoo Choi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-03-07 11:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20240225161430epcas1p371a4ee6a088b0121092af5064d56bc16@epcas1p3.samsung.com>
2024-02-25 15:54 ` [PATCH 0/7] extcon: Convert to platform remove callback returning void Uwe Kleine-König
2024-02-25 15:54 ` [PATCH 7/7] extcon: usbc-cros-ec: " Uwe Kleine-König
2024-02-26 5:48 ` Tzung-Bi Shih
2024-03-07 11:34 ` [PATCH 0/7] extcon: " Chanwoo Choi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox