]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/panel/sharp-ls043t1le01: Use refcounted allocation in place of devm_kzalloc()
authorAlbert Esteve <aesteve@redhat.com>
Fri, 8 May 2026 07:04:47 +0000 (09:04 +0200)
committerMaxime Ripard <mripard@kernel.org>
Mon, 11 May 2026 07:14:20 +0000 (09:14 +0200)
Move to using the new API devm_drm_panel_alloc() to allocate the
panel. In the call to the new API, avoid using explicit type and use
__typeof() for more type safety.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Albert Esteve <aesteve@redhat.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patch.msgid.link/20260508-drm_panel_init_rm-v2-7-0bd4ac429971@redhat.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>
drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c

index dd1eaba23ad3c69de49741657ce9490cde11ab74..989b030ea22de5ba0d9f72610e9292ae8837427d 100644 (file)
@@ -199,8 +199,6 @@ static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt)
                gpiod_set_value(sharp_nt->reset_gpio, 0);
        }
 
-       drm_panel_init(&sharp_nt->base, &sharp_nt->dsi->dev,
-                      &sharp_nt_panel_funcs, DRM_MODE_CONNECTOR_DSI);
        sharp_nt->base.prepare_prev_first = true;
 
        ret = drm_panel_of_backlight(&sharp_nt->base);
@@ -231,9 +229,12 @@ static int sharp_nt_panel_probe(struct mipi_dsi_device *dsi)
                        MIPI_DSI_CLOCK_NON_CONTINUOUS |
                        MIPI_DSI_MODE_NO_EOT_PACKET;
 
-       sharp_nt = devm_kzalloc(&dsi->dev, sizeof(*sharp_nt), GFP_KERNEL);
-       if (!sharp_nt)
-               return -ENOMEM;
+       sharp_nt = devm_drm_panel_alloc(&dsi->dev, __typeof(*sharp_nt), base,
+                                       &sharp_nt_panel_funcs,
+                                       DRM_MODE_CONNECTOR_DSI);
+
+       if (IS_ERR(sharp_nt))
+               return PTR_ERR(sharp_nt);
 
        mipi_dsi_set_drvdata(dsi, sharp_nt);