linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] gpu: Convert to platform remove callback returning void
@ 2024-04-09 17:02 Uwe Kleine-König
  2024-04-09 17:02 ` [PATCH 3/4] gpu: host1x: " Uwe Kleine-König
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2024-04-09 17:02 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter
  Cc: Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, dri-devel, linux-kernel, Chun-Kuang Hu,
	Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
	linux-mediatek, linux-arm-kernel, Thierry Reding,
	Mikko Perttunen, linux-tegra

Hello,

with some patches sent earlier[1], this series converts all platform
drivers below drivers/gpu to not use struct platform_device::remove()
any more.

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 the driver's .remove() callbacks
returned zero unconditionally.

There are no interdependencies between these patches. This is merge
window material.

Best regards
Uwe

Uwe Kleine-König (4):
  drm/imagination: Convert to platform remove callback returning void
  drm/mediatek: Convert to platform remove callback returning void
  gpu: host1x: Convert to platform remove callback returning void
  gpu: ipu-v3: Convert to platform remove callback returning void

 drivers/gpu/drm/imagination/pvr_drv.c  | 7 ++-----
 drivers/gpu/drm/mediatek/mtk_padding.c | 5 ++---
 drivers/gpu/host1x/dev.c               | 6 ++----
 drivers/gpu/ipu-v3/ipu-common.c        | 6 ++----
 drivers/gpu/ipu-v3/ipu-pre.c           | 5 ++---
 drivers/gpu/ipu-v3/ipu-prg.c           | 6 ++----
 6 files changed, 12 insertions(+), 23 deletions(-)

base-commit: a053fd3ca5d1b927a8655f239c84b0d790218fda
-- 
2.43.0


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

* [PATCH 3/4] gpu: host1x: Convert to platform remove callback returning void
  2024-04-09 17:02 [PATCH 0/4] gpu: Convert to platform remove callback returning void Uwe Kleine-König
@ 2024-04-09 17:02 ` Uwe Kleine-König
  2024-04-19 11:29   ` Thierry Reding
  2024-04-09 17:10 ` [PATCH 0/4] gpu: " Uwe Kleine-König
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2024-04-09 17:02 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter
  Cc: Thierry Reding, Mikko Perttunen, dri-devel, linux-tegra, 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/gpu/host1x/dev.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index 89983d7d73ca..bc02aa28458b 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -653,7 +653,7 @@ static int host1x_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int host1x_remove(struct platform_device *pdev)
+static void host1x_remove(struct platform_device *pdev)
 {
 	struct host1x *host = platform_get_drvdata(pdev);
 
@@ -668,8 +668,6 @@ static int host1x_remove(struct platform_device *pdev)
 	host1x_channel_list_free(&host->channel_list);
 	host1x_iommu_exit(host);
 	host1x_bo_cache_destroy(&host->cache);
-
-	return 0;
 }
 
 static int __maybe_unused host1x_runtime_suspend(struct device *dev)
@@ -754,7 +752,7 @@ static struct platform_driver tegra_host1x_driver = {
 		.pm = &host1x_pm_ops,
 	},
 	.probe = host1x_probe,
-	.remove = host1x_remove,
+	.remove_new = host1x_remove,
 };
 
 static struct platform_driver * const drivers[] = {
-- 
2.43.0


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

* Re: [PATCH 0/4] gpu: Convert to platform remove callback returning void
  2024-04-09 17:02 [PATCH 0/4] gpu: Convert to platform remove callback returning void Uwe Kleine-König
  2024-04-09 17:02 ` [PATCH 3/4] gpu: host1x: " Uwe Kleine-König
@ 2024-04-09 17:10 ` Uwe Kleine-König
  2024-04-09 18:59 ` Thomas Zimmermann
  2024-04-19  7:20 ` Uwe Kleine-König
  3 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2024-04-09 17:10 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter
  Cc: Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, dri-devel, linux-kernel, Chun-Kuang Hu,
	Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
	linux-mediatek, linux-arm-kernel, Thierry Reding,
	Mikko Perttunen, linux-tegra

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

On Tue, Apr 09, 2024 at 07:02:47PM +0200, Uwe Kleine-König wrote:
> Hello,
> 
> with some patches sent earlier[1], this series converts all platform
> drivers below drivers/gpu to not use struct platform_device::remove()
> any more.

I forgot to include footnote with the list of earlier patches. For
completeness:

[1]:
	https://lore.kernel.org/dri-devel/20240409165043.105137-2-u.kleine-koenig@pengutronix.de
	https://lore.kernel.org/dri-devel/20240304091005.717012-2-u.kleine-koenig@pengutronix.de
	https://lore.kernel.org/dri-devel/20240304090555.716327-2-u.kleine-koenig@pengutronix.de

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] 8+ messages in thread

* Re: [PATCH 0/4] gpu: Convert to platform remove callback returning void
  2024-04-09 17:02 [PATCH 0/4] gpu: Convert to platform remove callback returning void Uwe Kleine-König
  2024-04-09 17:02 ` [PATCH 3/4] gpu: host1x: " Uwe Kleine-König
  2024-04-09 17:10 ` [PATCH 0/4] gpu: " Uwe Kleine-König
@ 2024-04-09 18:59 ` Thomas Zimmermann
  2024-04-19  7:20 ` Uwe Kleine-König
  3 siblings, 0 replies; 8+ messages in thread
From: Thomas Zimmermann @ 2024-04-09 18:59 UTC (permalink / raw)
  To: Uwe Kleine-König, David Airlie, Daniel Vetter
  Cc: Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	dri-devel, linux-kernel, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, linux-mediatek,
	linux-arm-kernel, Thierry Reding, Mikko Perttunen, linux-tegra

Hi

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

for the series.

Best regards
Thomas

Am 09.04.24 um 19:02 schrieb Uwe Kleine-König:
> Hello,
>
> with some patches sent earlier[1], this series converts all platform
> drivers below drivers/gpu to not use struct platform_device::remove()
> any more.
>
> 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 the driver's .remove() callbacks
> returned zero unconditionally.
>
> There are no interdependencies between these patches. This is merge
> window material.
>
> Best regards
> Uwe
>
> Uwe Kleine-König (4):
>    drm/imagination: Convert to platform remove callback returning void
>    drm/mediatek: Convert to platform remove callback returning void
>    gpu: host1x: Convert to platform remove callback returning void
>    gpu: ipu-v3: Convert to platform remove callback returning void
>
>   drivers/gpu/drm/imagination/pvr_drv.c  | 7 ++-----
>   drivers/gpu/drm/mediatek/mtk_padding.c | 5 ++---
>   drivers/gpu/host1x/dev.c               | 6 ++----
>   drivers/gpu/ipu-v3/ipu-common.c        | 6 ++----
>   drivers/gpu/ipu-v3/ipu-pre.c           | 5 ++---
>   drivers/gpu/ipu-v3/ipu-prg.c           | 6 ++----
>   6 files changed, 12 insertions(+), 23 deletions(-)
>
> base-commit: a053fd3ca5d1b927a8655f239c84b0d790218fda

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


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

* Re: [PATCH 0/4] gpu: Convert to platform remove callback returning void
  2024-04-09 17:02 [PATCH 0/4] gpu: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (2 preceding siblings ...)
  2024-04-09 18:59 ` Thomas Zimmermann
@ 2024-04-19  7:20 ` Uwe Kleine-König
  2024-04-19 11:28   ` Thierry Reding
  2024-04-23  8:31   ` Matt Coster
  3 siblings, 2 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2024-04-19  7:20 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter
  Cc: Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, dri-devel, linux-kernel, Chun-Kuang Hu,
	Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
	linux-mediatek, linux-arm-kernel, Thierry Reding,
	Mikko Perttunen, linux-tegra

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

Hello,

On Tue, Apr 09, 2024 at 07:02:47PM +0200, Uwe Kleine-König wrote:
> with some patches sent earlier[1], this series converts all platform
> drivers below drivers/gpu to not use struct platform_device::remove()
> any more.
> 
> 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 the driver's .remove() callbacks
> returned zero unconditionally.
> 
> There are no interdependencies between these patches. This is merge
> window material.

I wonder how this series will make it in. While I would prefer these
patches to go in together (that I can consider this thread completed in
one go), I think with how drm maintenace works, it's best if the patches
are picked up by their individual maintainers. I guess that's:

 - Frank Binns + Matt Coster for imagination

 - Chun-Kuang Hu + Philipp Zabel for mediatek

 - Thierry Reding + Mikko Perttunen for the host1x driver
   (Note there is another patch for this driver set at
    20240409165043.105137-2-u.kleine-koenig@pengutronix.de that is
    relevant for the same quest.)

 - Philipp Zabel for ipu-v3

I plan to send a patch changing struct platform_driver::remove after the
end of the merge window leading to 6.10-rc1 for inclusion in next via
Greg's driver core. So please either care the patches land in 6.10-rc1
or ack that I include them in the submission to Greg.

Thanks for your cooperation,
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] 8+ messages in thread

* Re: [PATCH 0/4] gpu: Convert to platform remove callback returning void
  2024-04-19  7:20 ` Uwe Kleine-König
@ 2024-04-19 11:28   ` Thierry Reding
  2024-04-23  8:31   ` Matt Coster
  1 sibling, 0 replies; 8+ messages in thread
From: Thierry Reding @ 2024-04-19 11:28 UTC (permalink / raw)
  To: Uwe Kleine-König, David Airlie, Daniel Vetter
  Cc: Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, dri-devel, linux-kernel, Chun-Kuang Hu,
	Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
	linux-mediatek, linux-arm-kernel, Mikko Perttunen, linux-tegra

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

On Fri Apr 19, 2024 at 9:20 AM CEST, Uwe Kleine-König wrote:
> Hello,
>
> On Tue, Apr 09, 2024 at 07:02:47PM +0200, Uwe Kleine-König wrote:
> > with some patches sent earlier[1], this series converts all platform
> > drivers below drivers/gpu to not use struct platform_device::remove()
> > any more.
> > 
> > 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 the driver's .remove() callbacks
> > returned zero unconditionally.
> > 
> > There are no interdependencies between these patches. This is merge
> > window material.
>
> I wonder how this series will make it in. While I would prefer these
> patches to go in together (that I can consider this thread completed in
> one go), I think with how drm maintenace works, it's best if the patches
> are picked up by their individual maintainers. I guess that's:
>
>  - Frank Binns + Matt Coster for imagination
>
>  - Chun-Kuang Hu + Philipp Zabel for mediatek
>
>  - Thierry Reding + Mikko Perttunen for the host1x driver
>    (Note there is another patch for this driver set at
>     20240409165043.105137-2-u.kleine-koenig@pengutronix.de that is
>     relevant for the same quest.)
>
>  - Philipp Zabel for ipu-v3
>
> I plan to send a patch changing struct platform_driver::remove after the
> end of the merge window leading to 6.10-rc1 for inclusion in next via
> Greg's driver core. So please either care the patches land in 6.10-rc1
> or ack that I include them in the submission to Greg.

I think the latter would make more sense. I'll go ack those patches.

Thierry

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

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

* Re: [PATCH 3/4] gpu: host1x: Convert to platform remove callback returning void
  2024-04-09 17:02 ` [PATCH 3/4] gpu: host1x: " Uwe Kleine-König
@ 2024-04-19 11:29   ` Thierry Reding
  0 siblings, 0 replies; 8+ messages in thread
From: Thierry Reding @ 2024-04-19 11:29 UTC (permalink / raw)
  To: Uwe Kleine-König, David Airlie, Daniel Vetter
  Cc: Mikko Perttunen, dri-devel, linux-tegra, linux-kernel

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

On Tue Apr 9, 2024 at 7:02 PM CEST, 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>
> ---
>  drivers/gpu/host1x/dev.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Acked-by: Thierry Reding <treding@nvidia.com>

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

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

* Re: [PATCH 0/4] gpu: Convert to platform remove callback returning void
  2024-04-19  7:20 ` Uwe Kleine-König
  2024-04-19 11:28   ` Thierry Reding
@ 2024-04-23  8:31   ` Matt Coster
  1 sibling, 0 replies; 8+ messages in thread
From: Matt Coster @ 2024-04-23  8:31 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: David Airlie, Daniel Vetter, Frank Binns, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Thierry Reding,
	Mikko Perttunen, dri-devel, linux-mediatek, linux-arm-kernel,
	linux-tegra, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1810 bytes --]

On 19/04/2024 08:20, Uwe Kleine-König wrote:
> Hello,
> 
> On Tue, Apr 09, 2024 at 07:02:47PM +0200, Uwe Kleine-König wrote:
>> with some patches sent earlier[1], this series converts all platform
>> drivers below drivers/gpu to not use struct platform_device::remove()
>> any more.
>>
>> 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 the driver's .remove() callbacks
>> returned zero unconditionally.
>>
>> There are no interdependencies between these patches. This is merge
>> window material.
> 
> I wonder how this series will make it in. While I would prefer these
> patches to go in together (that I can consider this thread completed in
> one go), I think with how drm maintenace works, it's best if the patches
> are picked up by their individual maintainers. I guess that's:
> 
>  - Frank Binns + Matt Coster for imagination

I've acked the imagination patch - feel free to land it however you
like. We don't have a separate tree so we'd just land it in
drm-misc-next.

Cheers,
Matt

>  - Chun-Kuang Hu + Philipp Zabel for mediatek
> 
>  - Thierry Reding + Mikko Perttunen for the host1x driver
>    (Note there is another patch for this driver set at
>     20240409165043.105137-2-u.kleine-koenig@pengutronix.de that is
>     relevant for the same quest.)
> 
>  - Philipp Zabel for ipu-v3
> 
> I plan to send a patch changing struct platform_driver::remove after the
> end of the merge window leading to 6.10-rc1 for inclusion in next via
> Greg's driver core. So please either care the patches land in 6.10-rc1
> or ack that I include them in the submission to Greg.
> 
> Thanks for your cooperation,
> Uwe
> 

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

end of thread, other threads:[~2024-04-23  8:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-09 17:02 [PATCH 0/4] gpu: Convert to platform remove callback returning void Uwe Kleine-König
2024-04-09 17:02 ` [PATCH 3/4] gpu: host1x: " Uwe Kleine-König
2024-04-19 11:29   ` Thierry Reding
2024-04-09 17:10 ` [PATCH 0/4] gpu: " Uwe Kleine-König
2024-04-09 18:59 ` Thomas Zimmermann
2024-04-19  7:20 ` Uwe Kleine-König
2024-04-19 11:28   ` Thierry Reding
2024-04-23  8:31   ` Matt Coster

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).