Re: [PATCH v4 6/6] drm/panel: Use managed helpers in assorted panels

"Luca Ceresoli" <[email protected]>
Newsgroups org.freedesktop.lists.dri-devel,dev.linux.lists.asahi,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Wed Aug 12, 2026 at 5:53 PM CEST, Osama Abdelkader wrote:
> Use the managed MIPI DSI attach and panel add helpers in assorted
> panel drivers and drop the corresponding manual detach and panel remove
> calls from remove paths.
>
> Suggested-by: Luca Ceresoli <[email protected]>
> Signed-off-by: Osama Abdelkader <[email protected]>
> ---
> v4:
> - use devm_drm_panel_add instead of drm_panel_add.
>
>  drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c  | 20 +++--------
>  drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c | 20 +++--------
>  drivers/gpu/drm/panel/panel-dsi-cm.c          | 15 ++++-----
>  drivers/gpu/drm/panel/panel-ebbg-ft8719.c     | 20 +++--------
>  drivers/gpu/drm/panel/panel-elida-kd35t133.c  | 20 +++--------
>  drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c | 19 +++--------
>  drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c | 19 +++--------
>  drivers/gpu/drm/panel/panel-hydis-hv101hd1.c  | 24 +++-----------
>  drivers/gpu/drm/panel/panel-innolux-p079zca.c | 33 +++----------------
>  drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c  | 19 +++--------
>  drivers/gpu/drm/panel/panel-khadas-ts050.c    | 23 +++----------
>  drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c    | 30 ++---------------
>  drivers/gpu/drm/panel/panel-lg-sw43408.c      | 22 ++++---------
>  drivers/gpu/drm/panel/panel-lincolntech-lcd197.c  | 20 ++---------
>  drivers/gpu/drm/panel/panel-lxd-m9189a.c      | 24 +++-----------
>  drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c  | 16 +++------
>  drivers/gpu/drm/panel/panel-newvision-nv3051d.c   | 22 +++----------
>  drivers/gpu/drm/panel/panel-orisetech-otm8009a.c  | 16 +++------
>  drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c    | 23 +++----------
>  drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c  | 31 ++---------------
>  drivers/gpu/drm/panel/panel-ronbo-rb070d30.c  | 19 +++--------
>  drivers/gpu/drm/panel/panel-simple.c          | 22 ++++---------

I think due to its relevance, panel-simple should be a patch on its
own. But see below too.

...

> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -737,7 +737,9 @@ static struct panel_simple *panel_simple_probe(struct device *dev)
>  		goto disable_pm_runtime;
>  	}
>
> -	drm_panel_add(&panel->base);
> +	err = devm_drm_panel_add(dev, &panel->base);
> +	if (err)
> +		goto disable_pm_runtime;
>
>  	return panel;
>
> @@ -785,7 +787,6 @@ static void panel_simple_remove(struct device *dev)
>  {
>  	struct panel_simple *panel = dev_get_drvdata(dev);
>
> -	drm_panel_remove(&panel->base);
>  	panel_simple_shutdown(dev);
>
>  	pm_runtime_dont_use_autosuspend(dev);
> @@ -6551,24 +6552,15 @@ static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
>  	dsi->format = desc->format;
>  	dsi->lanes = desc->lanes;
>
> -	err = mipi_dsi_attach(dsi);
> -	if (err) {
> -		struct panel_simple *panel = mipi_dsi_get_drvdata(dsi);
> -
> -		drm_panel_remove(&panel->base);
> -	}
> +	err = devm_mipi_dsi_attach(&dsi->dev, dsi);
> +	if (err)
> +		return err;
>
> -	return err;
> +	return 0;
>  }
>
>  static void panel_simple_dsi_remove(struct mipi_dsi_device *dsi)
>  {
> -	int err;
> -
> -	err = mipi_dsi_detach(dsi);
> -	if (err < 0)
> -		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
> -
>  	panel_simple_remove(&dsi->dev);
>  }

You are changing the removal order here, with potential risk.

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.