* [PATCH 0/5] media: Convert to platform remove callback returning void
@ 2024-02-23 12:59 Uwe Kleine-König
2024-02-23 12:59 ` [PATCH 3/5] media: nxp: imx8-isi: " Uwe Kleine-König
2024-02-23 12:59 ` [PATCH 4/5] media: stm32-dcmipp: " Uwe Kleine-König
0 siblings, 2 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2024-02-23 12:59 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Nas Chung, Jackson Lee, linux-media, kernel, Joseph Liu,
Marvin Lin, openbmc, Laurent Pinchart, Shawn Guo, Sascha Hauer,
Fabio Estevam, NXP Linux Team, linux-arm-kernel, Hugues Fruchet,
Alain Volmat, Maxime Coquelin, Alexandre Torgue, linux-stm32,
Jai Luthra
Hello,
this series converts all drivers below drivers/media/platform 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 Mauro.
Best regards
Uwe
Uwe Kleine-König (5):
media: chips-media: wave5: Convert to platform remove callback
returning void
media: nuvoton: Convert to platform remove callback returning void
media: nxp: imx8-isi: Convert to platform remove callback returning
void
media: stm32-dcmipp: Convert to platform remove callback returning
void
media: ti: j721e-csi2rx: Convert to platform remove callback returning
void
drivers/media/platform/chips-media/wave5/wave5-vpu.c | 6 ++----
drivers/media/platform/nuvoton/npcm-video.c | 6 ++----
drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c | 6 ++----
drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c | 6 ++----
drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 6 ++----
5 files changed, 10 insertions(+), 20 deletions(-)
base-commit: 33e1d31873f87d119e5120b88cd350efa68ef276
--
2.43.0
_______________________________________________
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] 5+ messages in thread
* [PATCH 3/5] media: nxp: imx8-isi: Convert to platform remove callback returning void
2024-02-23 12:59 [PATCH 0/5] media: Convert to platform remove callback returning void Uwe Kleine-König
@ 2024-02-23 12:59 ` Uwe Kleine-König
2024-02-23 13:14 ` Laurent Pinchart
2024-02-23 12:59 ` [PATCH 4/5] media: stm32-dcmipp: " Uwe Kleine-König
1 sibling, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2024-02-23 12:59 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Laurent Pinchart, Shawn Guo, Sascha Hauer, Fabio Estevam,
NXP Linux Team, linux-media, linux-arm-kernel, 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/media/platform/nxp/imx8-isi/imx8-isi-core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
index f73facb97dc5..c2013995049c 100644
--- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
+++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
@@ -506,7 +506,7 @@ static int mxc_isi_probe(struct platform_device *pdev)
return ret;
}
-static int mxc_isi_remove(struct platform_device *pdev)
+static void mxc_isi_remove(struct platform_device *pdev)
{
struct mxc_isi_dev *isi = platform_get_drvdata(pdev);
unsigned int i;
@@ -523,8 +523,6 @@ static int mxc_isi_remove(struct platform_device *pdev)
mxc_isi_v4l2_cleanup(isi);
pm_runtime_disable(isi->dev);
-
- return 0;
}
static const struct of_device_id mxc_isi_of_match[] = {
@@ -537,7 +535,7 @@ MODULE_DEVICE_TABLE(of, mxc_isi_of_match);
static struct platform_driver mxc_isi_driver = {
.probe = mxc_isi_probe,
- .remove = mxc_isi_remove,
+ .remove_new = mxc_isi_remove,
.driver = {
.of_match_table = mxc_isi_of_match,
.name = MXC_ISI_DRIVER_NAME,
--
2.43.0
_______________________________________________
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] 5+ messages in thread
* [PATCH 4/5] media: stm32-dcmipp: Convert to platform remove callback returning void
2024-02-23 12:59 [PATCH 0/5] media: Convert to platform remove callback returning void Uwe Kleine-König
2024-02-23 12:59 ` [PATCH 3/5] media: nxp: imx8-isi: " Uwe Kleine-König
@ 2024-02-23 12:59 ` Uwe Kleine-König
2024-03-11 17:55 ` Alain Volmat
1 sibling, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2024-02-23 12:59 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Hugues Fruchet, Alain Volmat, Maxime Coquelin, Alexandre Torgue,
linux-media, linux-stm32, linux-arm-kernel, 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/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c
index 32c6619be9a2..bce821eb71ce 100644
--- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c
+++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c
@@ -517,7 +517,7 @@ static int dcmipp_probe(struct platform_device *pdev)
return 0;
}
-static int dcmipp_remove(struct platform_device *pdev)
+static void dcmipp_remove(struct platform_device *pdev)
{
struct dcmipp_device *dcmipp = platform_get_drvdata(pdev);
unsigned int i;
@@ -534,8 +534,6 @@ static int dcmipp_remove(struct platform_device *pdev)
media_device_cleanup(&dcmipp->mdev);
v4l2_device_unregister(&dcmipp->v4l2_dev);
-
- return 0;
}
static int dcmipp_runtime_suspend(struct device *dev)
@@ -588,7 +586,7 @@ static const struct dev_pm_ops dcmipp_pm_ops = {
static struct platform_driver dcmipp_pdrv = {
.probe = dcmipp_probe,
- .remove = dcmipp_remove,
+ .remove_new = dcmipp_remove,
.driver = {
.name = DCMIPP_PDEV_NAME,
.of_match_table = dcmipp_of_match,
--
2.43.0
_______________________________________________
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] 5+ messages in thread
* Re: [PATCH 3/5] media: nxp: imx8-isi: Convert to platform remove callback returning void
2024-02-23 12:59 ` [PATCH 3/5] media: nxp: imx8-isi: " Uwe Kleine-König
@ 2024-02-23 13:14 ` Laurent Pinchart
0 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2024-02-23 13:14 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer, Fabio Estevam,
NXP Linux Team, linux-media, linux-arm-kernel, kernel
Hi Uwe,
Thank you for the patch.
On Fri, Feb 23, 2024 at 01:59:06PM +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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
> index f73facb97dc5..c2013995049c 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
> @@ -506,7 +506,7 @@ static int mxc_isi_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int mxc_isi_remove(struct platform_device *pdev)
> +static void mxc_isi_remove(struct platform_device *pdev)
> {
> struct mxc_isi_dev *isi = platform_get_drvdata(pdev);
> unsigned int i;
> @@ -523,8 +523,6 @@ static int mxc_isi_remove(struct platform_device *pdev)
> mxc_isi_v4l2_cleanup(isi);
>
> pm_runtime_disable(isi->dev);
> -
> - return 0;
> }
>
> static const struct of_device_id mxc_isi_of_match[] = {
> @@ -537,7 +535,7 @@ MODULE_DEVICE_TABLE(of, mxc_isi_of_match);
>
> static struct platform_driver mxc_isi_driver = {
> .probe = mxc_isi_probe,
> - .remove = mxc_isi_remove,
> + .remove_new = mxc_isi_remove,
> .driver = {
> .of_match_table = mxc_isi_of_match,
> .name = MXC_ISI_DRIVER_NAME,
--
Regards,
Laurent Pinchart
_______________________________________________
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] 5+ messages in thread
* Re: [PATCH 4/5] media: stm32-dcmipp: Convert to platform remove callback returning void
2024-02-23 12:59 ` [PATCH 4/5] media: stm32-dcmipp: " Uwe Kleine-König
@ 2024-03-11 17:55 ` Alain Volmat
0 siblings, 0 replies; 5+ messages in thread
From: Alain Volmat @ 2024-03-11 17:55 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Mauro Carvalho Chehab, Hugues Fruchet, Maxime Coquelin,
Alexandre Torgue, linux-media, linux-stm32, linux-arm-kernel,
kernel
Hi Uwe,
thank you for your patch.
On Fri, Feb 23, 2024 at 01:59:07PM +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: Alain Volmat <alain.volmat@foss.st.com>
> ---
> drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c
> index 32c6619be9a2..bce821eb71ce 100644
> --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c
> +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c
> @@ -517,7 +517,7 @@ static int dcmipp_probe(struct platform_device *pdev)
> return 0;
> }
>
> -static int dcmipp_remove(struct platform_device *pdev)
> +static void dcmipp_remove(struct platform_device *pdev)
> {
> struct dcmipp_device *dcmipp = platform_get_drvdata(pdev);
> unsigned int i;
> @@ -534,8 +534,6 @@ static int dcmipp_remove(struct platform_device *pdev)
> media_device_cleanup(&dcmipp->mdev);
>
> v4l2_device_unregister(&dcmipp->v4l2_dev);
> -
> - return 0;
> }
>
> static int dcmipp_runtime_suspend(struct device *dev)
> @@ -588,7 +586,7 @@ static const struct dev_pm_ops dcmipp_pm_ops = {
>
> static struct platform_driver dcmipp_pdrv = {
> .probe = dcmipp_probe,
> - .remove = dcmipp_remove,
> + .remove_new = dcmipp_remove,
> .driver = {
> .name = DCMIPP_PDEV_NAME,
> .of_match_table = dcmipp_of_match,
> --
> 2.43.0
>
Regards,
Alain
_______________________________________________
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] 5+ messages in thread
end of thread, other threads:[~2024-03-11 17:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-23 12:59 [PATCH 0/5] media: Convert to platform remove callback returning void Uwe Kleine-König
2024-02-23 12:59 ` [PATCH 3/5] media: nxp: imx8-isi: " Uwe Kleine-König
2024-02-23 13:14 ` Laurent Pinchart
2024-02-23 12:59 ` [PATCH 4/5] media: stm32-dcmipp: " Uwe Kleine-König
2024-03-11 17:55 ` Alain Volmat
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).