drm/panel/ilitek-ili9806e: Use refcounted allocation in place of devm_kzalloc()

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>
This commit is contained in:
Albert Esteve 2026-05-08 09:04:45 +02:00 committed by Maxime Ripard
parent c8c80bde16
commit 98c38ff51e
No known key found for this signature in database
GPG Key ID: 275FCE19A23DBE76

View 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");