mbox series

[v3,00/16] drm: Convert to platform remove callback returning void

Message ID 20231102165640.3307820-18-u.kleine-koenig@pengutronix.de (mailing list archive)
Headers show
Series drm: Convert to platform remove callback returning void | expand

Message

Uwe Kleine-König Nov. 2, 2023, 4:56 p.m. UTC
Hello,

this series converts all platform drivers below drivers/gpu/drm to use
.remove_new(). It starts with a fix for a problem that potentially might
crash the kernel that I stumbled over while implementing the conversion.

Some of the conversion patches following this fix were already send in
earlier series:

	https://lore.kernel.org/dri-devel/20230801110239.831099-1-u.kleine-koenig@pengutronix.de
	https://lore.kernel.org/dri-devel/20230318190804.234610-1-u.kleine-koenig@pengutronix.de

and three patches (bridge/tpd12s015, exynos + tilcdc) are new. Parts of
the above series were picked up, the patches resend here are not.

See commit 5c5a7680e67b ("platform: Provide a remove callback that
returns no value") for an extended explanation and the eventual goal.

Compared to the earlier submissions this patch series is rebased to
today's drm-misc-next. Otherwise there is no relevant change.

Best regards
Uwe

Uwe Kleine-König (16):
  drm/bridge: tpd12s015: Drop buggy __exit annotation for remove
    function
  drm/arcpgu: Convert to platform remove callback returning void
  drm/armada: Convert to platform remove callback returning void
  drm/bridge: cdns-mhdp8546: Improve error reporting in remove callback
  drm/bridge: cdns-mhdp8546: Convert to platform remove callback
    returning void
  drm/bridge: tpd12s015: Convert to platform remove callback returning
    void
  drm/etnaviv: Convert to platform remove callback returning void
  drm/exynos: Convert to platform remove callback returning void
  drm/imx/dcss: Convert to platform remove callback returning void
  drm/imx: lcdc: Convert to platform remove callback returning void
  drm/kmb: Convert to platform remove callback returning void
  drm/mediatek: Convert to platform remove callback returning void
  drm/meson: Convert to platform remove callback returning void
  drm/nouveau: Convert to platform remove callback returning void
  drm/sprd: Convert to platform remove callback returning void
  drm/tilcdc: Convert to platform remove callback returning void

 drivers/gpu/drm/armada/armada_crtc.c          |  5 ++---
 drivers/gpu/drm/armada/armada_drv.c           |  5 ++---
 .../drm/bridge/cadence/cdns-mhdp8546-core.c   | 22 +++++++++----------
 drivers/gpu/drm/bridge/ti-tpd12s015.c         |  6 ++---
 drivers/gpu/drm/etnaviv/etnaviv_drv.c         |  6 ++---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c         |  5 ++---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  6 ++---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c    |  6 ++---
 drivers/gpu/drm/exynos/exynos_dp.c            |  6 ++---
 drivers/gpu/drm/exynos/exynos_drm_drv.c       |  5 ++---
 drivers/gpu/drm/exynos/exynos_drm_fimc.c      |  6 ++---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c      |  6 ++---
 drivers/gpu/drm/exynos/exynos_drm_g2d.c       |  6 ++---
 drivers/gpu/drm/exynos/exynos_drm_gsc.c       |  6 ++---
 drivers/gpu/drm/exynos/exynos_drm_mic.c       |  6 ++---
 drivers/gpu/drm/exynos/exynos_drm_rotator.c   |  6 ++---
 drivers/gpu/drm/exynos/exynos_drm_scaler.c    |  6 ++---
 drivers/gpu/drm/exynos/exynos_drm_vidi.c      |  6 ++---
 drivers/gpu/drm/exynos/exynos_hdmi.c          |  6 ++---
 drivers/gpu/drm/exynos/exynos_mixer.c         |  6 ++---
 drivers/gpu/drm/imx/dcss/dcss-drv.c           |  6 ++---
 drivers/gpu/drm/imx/lcdc/imx-lcdc.c           |  6 ++---
 drivers/gpu/drm/kmb/kmb_drv.c                 |  5 ++---
 .../gpu/drm/mediatek/mtk_disp_ovl_adaptor.c   |  5 ++---
 drivers/gpu/drm/mediatek/mtk_ethdr.c          |  5 ++---
 drivers/gpu/drm/meson/meson_dw_mipi_dsi.c     |  6 ++---
 drivers/gpu/drm/nouveau/nouveau_platform.c    |  5 ++---
 drivers/gpu/drm/sprd/sprd_dpu.c               |  6 ++---
 drivers/gpu/drm/sprd/sprd_drm.c               |  5 ++---
 drivers/gpu/drm/sprd/sprd_dsi.c               |  6 ++---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c           |  9 ++++----
 drivers/gpu/drm/tiny/arcpgu.c                 |  6 ++---
 32 files changed, 74 insertions(+), 128 deletions(-)


base-commit: 6fd9487147c4f18ad77eea00bd8c9189eec74a3e

Comments

Uwe Kleine-König Nov. 20, 2023, 12:05 p.m. UTC | #1
[Dropped a few people from To that resulted in bounces before.]

On Thu, Nov 02, 2023 at 05:56:41PM +0100, Uwe Kleine-König wrote:
> Hello,
> 
> this series converts all platform drivers below drivers/gpu/drm to use
> .remove_new(). It starts with a fix for a problem that potentially might
> crash the kernel that I stumbled over while implementing the conversion.
> 
> Some of the conversion patches following this fix were already send in
> earlier series:
> 
> 	https://lore.kernel.org/dri-devel/20230801110239.831099-1-u.kleine-koenig@pengutronix.de
> 	https://lore.kernel.org/dri-devel/20230318190804.234610-1-u.kleine-koenig@pengutronix.de
> 
> and three patches (bridge/tpd12s015, exynos + tilcdc) are new. Parts of
> the above series were picked up, the patches resend here are not.

Apart from a Reviewed-by: by Toni Valkeinen for patch #16 and Inki Dae
who wrote to have taken patch #8 (but that didn't appear in neither next
nor drm-misc-next yet).

Also in v2 they didn't result in euphoric replies.

Can someone who cares about drm as a whole please care for this series
apply it?

Best regards
Uwe
Thomas Zimmermann Nov. 21, 2023, 8:21 a.m. UTC | #2
Hi

Am 20.11.23 um 13:05 schrieb Uwe Kleine-König:
> [Dropped a few people from To that resulted in bounces before.]
> 
> On Thu, Nov 02, 2023 at 05:56:41PM +0100, Uwe Kleine-König wrote:
>> Hello,
>>
>> this series converts all platform drivers below drivers/gpu/drm to use
>> .remove_new(). It starts with a fix for a problem that potentially might
>> crash the kernel that I stumbled over while implementing the conversion.
>>
>> Some of the conversion patches following this fix were already send in
>> earlier series:
>>
>> 	https://lore.kernel.org/dri-devel/20230801110239.831099-1-u.kleine-koenig@pengutronix.de
>> 	https://lore.kernel.org/dri-devel/20230318190804.234610-1-u.kleine-koenig@pengutronix.de
>>
>> and three patches (bridge/tpd12s015, exynos + tilcdc) are new. Parts of
>> the above series were picked up, the patches resend here are not.
> 
> Apart from a Reviewed-by: by Toni Valkeinen for patch #16 and Inki Dae
> who wrote to have taken patch #8 (but that didn't appear in neither next
> nor drm-misc-next yet).
> 
> Also in v2 they didn't result in euphoric replies.
> 
> Can someone who cares about drm as a whole please care for this series
> apply it?

Except for patches 8 and 16, I've pushed this patchset into drm-misc-next.

Best regards
Thomas

> 
> Best regards
> Uwe
>
Jyri Sarha Nov. 28, 2023, 7:47 p.m. UTC | #3
November 2, 2023 at 6:56 PM, "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de mailto:u.kleine-koenig@pengutronix.de?to=%22Uwe%20Kleine-K%C3%B6nig%22%20%3Cu.kleine-koenig%40pengutronix.de%3E > 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.
> 
> There is one error path in tilcdc_pdev_remove() that potentially could
> yield a non-zero return code. In this case an error message describing
> the failure is emitted now instead of
> 
>  remove callback returned a non-zero value. This will be ignored.
> 
> before. Otherwise there is no difference. Also note that currently
> tilcdc_get_external_components() doesn't return negative values.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Applied this on top of drm-misc-next, dug up my good old Beaglebone-Black,and tested that everything still works, so:

Tested-by: Jyri Sarha <jyri.sarha@iki.fi>

I'll apply this shortly to drm-misc-next.

Best regards,
Jyri

> ---
> drivers/gpu/drm/tilcdc/tilcdc_drv.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> index 8ebd7134ee21..137cd9f62e9f 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> @@ -570,19 +570,18 @@ static int tilcdc_pdev_probe(struct platform_device *pdev)
>  match);
> }
> 
> -static int tilcdc_pdev_remove(struct platform_device *pdev)
> +static void tilcdc_pdev_remove(struct platform_device *pdev)
> {
>  int ret;
> 
>  ret = tilcdc_get_external_components(&pdev->dev, NULL);
>  if (ret < 0)
> - return ret;
> + dev_err(&pdev->dev, "tilcdc_get_external_components() failed (%pe)\n",
> + ERR_PTR(ret));
>  else if (ret == 0)
>  tilcdc_fini(platform_get_drvdata(pdev));
>  else
>  component_master_del(&pdev->dev, &tilcdc_comp_ops);
> -
> - return 0;
> }
> 
> static void tilcdc_pdev_shutdown(struct platform_device *pdev)
> @@ -599,7 +598,7 @@ MODULE_DEVICE_TABLE(of, tilcdc_of_match);
> 
> static struct platform_driver tilcdc_platform_driver = {
>  .probe = tilcdc_pdev_probe,
> - .remove = tilcdc_pdev_remove,
> + .remove_new = tilcdc_pdev_remove,
>  .shutdown = tilcdc_pdev_shutdown,
>  .driver = {
>  .name = "tilcdc",
> -- 
> 2.42.0
>