]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/panel/lxd-m9189a: Use refcounted allocation in place of devm_kzalloc()
authorAlbert Esteve <aesteve@redhat.com>
Fri, 8 May 2026 07:04:44 +0000 (09:04 +0200)
committerMaxime Ripard <mripard@kernel.org>
Mon, 11 May 2026 07:14:18 +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-4-0bd4ac429971@redhat.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>
drivers/gpu/drm/panel/panel-lxd-m9189a.c

index 68019e1e43a96309f9eb5caebf57eaac21cc5810..baaf170779e032086cb6b1a843b8af65bb47928e 100644 (file)
@@ -165,9 +165,12 @@ static int lxd_m9189_probe(struct mipi_dsi_device *dsi)
        struct m9189_panel *m9189;
        int ret;
 
-       m9189 = devm_kzalloc(dev, sizeof(*m9189), GFP_KERNEL);
-       if (!m9189)
-               return -ENOMEM;
+       m9189 = devm_drm_panel_alloc(dev, __typeof(*m9189), panel,
+                                   &m9189_panel_funcs,
+                                   DRM_MODE_CONNECTOR_DSI);
+
+       if (IS_ERR(m9189))
+               return PTR_ERR(m9189);
 
        m9189->supply = devm_regulator_get(dev, "power");
        if (IS_ERR(m9189->supply))
@@ -191,8 +194,6 @@ static int lxd_m9189_probe(struct mipi_dsi_device *dsi)
        dsi->format = MIPI_DSI_FMT_RGB888;
        dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST;
 
-       drm_panel_init(&m9189->panel, dev, &m9189_panel_funcs,
-                      DRM_MODE_CONNECTOR_DSI);
        m9189->panel.prepare_prev_first = true;
 
        ret = drm_panel_of_backlight(&m9189->panel);