drm/panel/khadas-ts050: 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.

Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
Link: https://lore.kernel.org/r/20250710-b4-driver-convert-last-part-july-v1-8-de73ba81b2f5@redhat.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>
This commit is contained in:
Anusha Srivatsa 2025-07-10 23:31:19 -05:00 committed by Maxime Ripard
parent 6a855c7f56
commit 95ec5c606d
No known key found for this signature in database
GPG Key ID: 275FCE19A23DBE76

View File

@ -821,9 +821,6 @@ static int khadas_ts050_panel_add(struct khadas_ts050_panel *khadas_ts050)
return dev_err_probe(dev, PTR_ERR(khadas_ts050->enable_gpio),
"failed to get enable gpio");
drm_panel_init(&khadas_ts050->base, &khadas_ts050->link->dev,
&khadas_ts050_panel_funcs, DRM_MODE_CONNECTOR_DSI);
err = drm_panel_of_backlight(&khadas_ts050->base);
if (err)
return err;
@ -850,10 +847,12 @@ static int khadas_ts050_panel_probe(struct mipi_dsi_device *dsi)
dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET;
khadas_ts050 = devm_kzalloc(&dsi->dev, sizeof(*khadas_ts050),
GFP_KERNEL);
if (!khadas_ts050)
return -ENOMEM;
khadas_ts050 = devm_drm_panel_alloc(&dsi->dev, __typeof(*khadas_ts050),
base, &khadas_ts050_panel_funcs,
DRM_MODE_CONNECTOR_DSI);
if (IS_ERR(khadas_ts050))
return PTR_ERR(khadas_ts050);
khadas_ts050->panel_data = (struct khadas_ts050_panel_data *)data;
mipi_dsi_set_drvdata(dsi, khadas_ts050);