Re: [PATCH v2 3/3] drm/panel: lg-sw43408: use devm_drm_panel_add()

From: Dmitry Baryshkov

Date: Thu May 07 2026 - 05:06:20 EST


On Thu, Apr 23, 2026 at 09:59:22PM +0900, Myeonghun Pak wrote:
> Replace drm_panel_add()/drm_panel_remove() with devm_drm_panel_add()
> now that drm-misc-next provides it. This keeps panel deregistration tied
> to the device lifetime and removes the manual cleanup from the remove
> callback.
>
> Signed-off-by: Myeonghun Pak <mhun512@xxxxxxxxx>
> ---
> drivers/gpu/drm/panel/panel-lg-sw43408.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-lg-sw43408.c b/drivers/gpu/drm/panel/panel-lg-sw43408.c
> index 293826c500..8969f57b89 100644
> --- a/drivers/gpu/drm/panel/panel-lg-sw43408.c
> +++ b/drivers/gpu/drm/panel/panel-lg-sw43408.c
> @@ -254,8 +254,11 @@ static int sw43408_add(struct sw43408_panel *ctx)
>
> ctx->base.prepare_prev_first = true;
>
> - drm_panel_add(&ctx->base);
> - return ret;
> + ret = devm_drm_panel_add(dev, &ctx->base);
> + if (ret < 0)
> + return dev_err_probe(dev, ret, "Failed to add panel\n");
> +
> + return 0;
> }
>
> static int sw43408_probe(struct mipi_dsi_device *dsi)
> @@ -299,14 +302,11 @@ static int sw43408_probe(struct mipi_dsi_device *dsi)
>
> static void sw43408_remove(struct mipi_dsi_device *dsi)
> {
> - struct sw43408_panel *ctx = mipi_dsi_get_drvdata(dsi);
> int ret;
>
> ret = mipi_dsi_detach(dsi);

This begs to use devm_mipi_dsi_attach() in the probe function. The whole
remove callback can be removed then.

> if (ret < 0)
> dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
> -
> - drm_panel_remove(&ctx->base);
> }
>
> static struct mipi_dsi_driver sw43408_driver = {
> --
> 2.47.1
>

--
With best wishes
Dmitry