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

index be2cf144015535b38968f89d8ea505001c8cd294..53e25d1086db89723f063cc79be11dc52a908e24 100644 (file)
@@ -78,9 +78,11 @@ int ili9806e_probe(struct device *dev, void *transport,
        bool set_prepare_prev_first = false;
        int ret;
 
-       ctx = devm_kzalloc(dev, sizeof(struct ili9806e), GFP_KERNEL);
-       if (!ctx)
-               return -ENOMEM;
+       ctx = devm_drm_panel_alloc(dev, __typeof(*ctx), panel,
+                                 funcs, connector_type);
+
+       if (IS_ERR(ctx))
+               return PTR_ERR(ctx);
 
        dev_set_drvdata(dev, ctx);
        ctx->transport = transport;
@@ -103,8 +105,6 @@ int ili9806e_probe(struct device *dev, void *transport,
                return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
                                     "Failed to get reset-gpios\n");
 
-       drm_panel_init(&ctx->panel, dev, funcs, connector_type);
-
        ret = drm_panel_of_backlight(&ctx->panel);
        if (ret)
                return dev_err_probe(dev, ret, "Failed to get backlight\n");