* [PATCH 00/13] backlight: Convert to platform remove callback returning void
@ 2023-03-08 7:39 Uwe Kleine-König
2023-03-08 7:39 ` [PATCH 09/13] backlight: mt6370-backlight: " Uwe Kleine-König
2023-03-08 12:04 ` [PATCH 00/13] backlight: " Daniel Thompson
0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2023-03-08 7:39 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Helge Deller,
Michael Hennerich, Support Opensource, Matthias Brugger,
Thierry Reding, Andy Gross, Bjorn Andersson
Cc: dri-devel, linux-fbdev, kernel, AngeloGioacchino Del Regno,
linux-arm-kernel, linux-mediatek, linux-pwm, Konrad Dybcio,
linux-arm-msm
Hello,
this patch series adapts the platform drivers below drivers/video/backlight to
use the .remove_new() callback. Compared to the traditional .remove() callback
.remove_new() returns no value. This is a good thing because the driver core
doesn't (and cannot) cope for errors during remove. The only effect of a
non-zero return value in .remove() is that the driver core emits a warning. The
device is removed anyhow and an early return from .remove() usually yields a
resource leak.
By changing the remove callback to return void driver authors cannot
reasonably assume any more that there is some kind of cleanup later.
All drivers in drivers/video/backlight returned zero unconditionally in their
remove callback, so they could all be converted trivially to .remove_new().
Note that this series depends on commit 5c5a7680e67b ("platform: Provide
a remove callback that returns no value") which is included in v6.3-rc1.
Best regards
Uwe
Uwe Kleine-König (13):
backlight: aat2870_bl: Convert to platform remove callback returning
void
backlight: adp5520_bl: Convert to platform remove callback returning
void
backlight: cr_bllcd: Convert to platform remove callback returning
void
backlight: da9052_bl: Convert to platform remove callback returning
void
backlight: hp680_bl: Convert to platform remove callback returning
void
backlight: led_bl: Convert to platform remove callback returning void
backlight: lm3533_bl: Convert to platform remove callback returning
void
backlight: lp8788_bl: Convert to platform remove callback returning
void
backlight: mt6370-backlight: Convert to platform remove callback
returning void
backlight: pwm_bl: Convert to platform remove callback returning void
backlight: qcom-wled: Convert to platform remove callback returning
void
backlight: rt4831-backlight: Convert to platform remove callback
returning void
backlight: sky81452-backlight: Convert to platform remove callback
returning void
drivers/video/backlight/aat2870_bl.c | 6 ++----
drivers/video/backlight/adp5520_bl.c | 6 ++----
drivers/video/backlight/cr_bllcd.c | 6 ++----
drivers/video/backlight/da9052_bl.c | 6 ++----
drivers/video/backlight/hp680_bl.c | 6 ++----
drivers/video/backlight/led_bl.c | 6 ++----
drivers/video/backlight/lm3533_bl.c | 6 ++----
drivers/video/backlight/lp8788_bl.c | 6 ++----
drivers/video/backlight/mt6370-backlight.c | 6 ++----
drivers/video/backlight/pwm_bl.c | 6 ++----
drivers/video/backlight/qcom-wled.c | 6 ++----
drivers/video/backlight/rt4831-backlight.c | 6 ++----
drivers/video/backlight/sky81452-backlight.c | 6 ++----
13 files changed, 26 insertions(+), 52 deletions(-)
base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
--
2.39.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 09/13] backlight: mt6370-backlight: Convert to platform remove callback returning void
2023-03-08 7:39 [PATCH 00/13] backlight: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-03-08 7:39 ` Uwe Kleine-König
2023-03-16 13:50 ` Lee Jones
2023-03-08 12:04 ` [PATCH 00/13] backlight: " Daniel Thompson
1 sibling, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2023-03-08 7:39 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Helge Deller,
Matthias Brugger
Cc: AngeloGioacchino Del Regno, dri-devel, linux-fbdev, kernel,
linux-arm-kernel, linux-mediatek
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 (mostly) ignored
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.
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/video/backlight/mt6370-backlight.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/video/backlight/mt6370-backlight.c b/drivers/video/backlight/mt6370-backlight.c
index 623d4f2baca2..94422c956453 100644
--- a/drivers/video/backlight/mt6370-backlight.c
+++ b/drivers/video/backlight/mt6370-backlight.c
@@ -318,15 +318,13 @@ static int mt6370_bl_probe(struct platform_device *pdev)
return 0;
}
-static int mt6370_bl_remove(struct platform_device *pdev)
+static void mt6370_bl_remove(struct platform_device *pdev)
{
struct mt6370_priv *priv = platform_get_drvdata(pdev);
struct backlight_device *bl_dev = priv->bl;
bl_dev->props.brightness = 0;
backlight_update_status(priv->bl);
-
- return 0;
}
static const struct of_device_id mt6370_bl_of_match[] = {
@@ -342,7 +340,7 @@ static struct platform_driver mt6370_bl_driver = {
.of_match_table = mt6370_bl_of_match,
},
.probe = mt6370_bl_probe,
- .remove = mt6370_bl_remove,
+ .remove_new = mt6370_bl_remove,
};
module_platform_driver(mt6370_bl_driver);
--
2.39.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 09/13] backlight: mt6370-backlight: Convert to platform remove callback returning void
2023-03-08 7:39 ` [PATCH 09/13] backlight: mt6370-backlight: " Uwe Kleine-König
@ 2023-03-16 13:50 ` Lee Jones
0 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2023-03-16 13:50 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Daniel Thompson, Jingoo Han, Helge Deller, Matthias Brugger,
AngeloGioacchino Del Regno, dri-devel, linux-fbdev, kernel,
linux-arm-kernel, linux-mediatek
On Wed, 08 Mar 2023, 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 (mostly) ignored
> 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.
>
> 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/video/backlight/mt6370-backlight.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
Applied, thanks
--
Lee Jones [李琼斯]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 00/13] backlight: Convert to platform remove callback returning void
2023-03-08 7:39 [PATCH 00/13] backlight: Convert to platform remove callback returning void Uwe Kleine-König
2023-03-08 7:39 ` [PATCH 09/13] backlight: mt6370-backlight: " Uwe Kleine-König
@ 2023-03-08 12:04 ` Daniel Thompson
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Thompson @ 2023-03-08 12:04 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Lee Jones, Jingoo Han, Helge Deller, Michael Hennerich,
Support Opensource, Matthias Brugger, Thierry Reding, Andy Gross,
Bjorn Andersson, dri-devel, linux-fbdev, kernel,
AngeloGioacchino Del Regno, linux-arm-kernel, linux-mediatek,
linux-pwm, Konrad Dybcio, linux-arm-msm
On Wed, Mar 08, 2023 at 08:39:32AM +0100, Uwe Kleine-König wrote:
> Uwe Kleine-König (13):
> backlight: aat2870_bl: Convert to platform remove callback returning
> void
> backlight: adp5520_bl: Convert to platform remove callback returning
> void
> backlight: cr_bllcd: Convert to platform remove callback returning
> void
> backlight: da9052_bl: Convert to platform remove callback returning
> void
> backlight: hp680_bl: Convert to platform remove callback returning
> void
> backlight: led_bl: Convert to platform remove callback returning void
> backlight: lm3533_bl: Convert to platform remove callback returning
> void
> backlight: lp8788_bl: Convert to platform remove callback returning
> void
> backlight: mt6370-backlight: Convert to platform remove callback
> returning void
> backlight: pwm_bl: Convert to platform remove callback returning void
> backlight: qcom-wled: Convert to platform remove callback returning
> void
> backlight: rt4831-backlight: Convert to platform remove callback
> returning void
> backlight: sky81452-backlight: Convert to platform remove callback
> returning void
Whole series is:
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Thanks!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-16 13:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-08 7:39 [PATCH 00/13] backlight: Convert to platform remove callback returning void Uwe Kleine-König
2023-03-08 7:39 ` [PATCH 09/13] backlight: mt6370-backlight: " Uwe Kleine-König
2023-03-16 13:50 ` Lee Jones
2023-03-08 12:04 ` [PATCH 00/13] backlight: " Daniel Thompson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).