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

index ea241c89593b6726e8356c30229e99191c69bf03..997115b1e541d7f978997f4585144829c24f0d5d 100644 (file)
@@ -677,9 +677,13 @@ int s6e63m0_probe(struct device *dev, void *trsp,
        u32 max_brightness;
        int ret;
 
-       ctx = devm_kzalloc(dev, sizeof(struct s6e63m0), GFP_KERNEL);
-       if (!ctx)
-               return -ENOMEM;
+       ctx = devm_drm_panel_alloc(dev, __typeof(*ctx), panel,
+                                 &s6e63m0_drm_funcs,
+                                 dsi_mode ? DRM_MODE_CONNECTOR_DSI :
+                                 DRM_MODE_CONNECTOR_DPI);
+
+       if (IS_ERR(ctx))
+               return PTR_ERR(ctx);
 
        ctx->transport_data = trsp;
        ctx->dsi_mode = dsi_mode;
@@ -712,10 +716,6 @@ int s6e63m0_probe(struct device *dev, void *trsp,
                return PTR_ERR(ctx->reset_gpio);
        }
 
-       drm_panel_init(&ctx->panel, dev, &s6e63m0_drm_funcs,
-                      dsi_mode ? DRM_MODE_CONNECTOR_DSI :
-                      DRM_MODE_CONNECTOR_DPI);
-
        ret = s6e63m0_backlight_register(ctx, max_brightness);
        if (ret < 0)
                return ret;