]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/panel/visionox-g2647fb105: Use refcounted allocation in place of devm_kzalloc()
authorAlbert Esteve <aesteve@redhat.com>
Fri, 8 May 2026 07:04:41 +0000 (09:04 +0200)
committerMaxime Ripard <mripard@kernel.org>
Mon, 11 May 2026 07:14:16 +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. Also deduplicate the prepare_prev_first
assignment that was set both before and after drm_panel_init().

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-1-0bd4ac429971@redhat.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>
drivers/gpu/drm/panel/panel-visionox-g2647fb105.c

index 413849f7b4dec97e9afa2df2843ef25898ed2549..d5555a17315751cf84b601d9eebdb60687888162 100644 (file)
@@ -207,9 +207,12 @@ static int visionox_g2647fb105_probe(struct mipi_dsi_device *dsi)
        struct visionox_g2647fb105 *ctx;
        int ret;
 
-       ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
-       if (!ctx)
-               return -ENOMEM;
+       ctx = devm_drm_panel_alloc(dev, __typeof(*ctx), panel,
+                                 &visionox_g2647fb105_panel_funcs,
+                                 DRM_MODE_CONNECTOR_DSI);
+
+       if (IS_ERR(ctx))
+               return PTR_ERR(ctx);
 
        ret = devm_regulator_bulk_get_const(dev,
                                            ARRAY_SIZE(visionox_g2647fb105_supplies),
@@ -233,10 +236,6 @@ static int visionox_g2647fb105_probe(struct mipi_dsi_device *dsi)
 
        ctx->panel.prepare_prev_first = true;
 
-       drm_panel_init(&ctx->panel, dev, &visionox_g2647fb105_panel_funcs,
-                      DRM_MODE_CONNECTOR_DSI);
-       ctx->panel.prepare_prev_first = true;
-
        ctx->panel.backlight = visionox_g2647fb105_create_backlight(dsi);
        if (IS_ERR(ctx->panel.backlight))
                return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight),