Skip to content

Commit 95ec5c6

Browse files
anushasrivatsmripard
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/20250710-b4-driver-convert-last-part-july-v1-8-de73ba81b2f5@redhat.com Signed-off-by: Maxime Ripard <[email protected]>
1 parent 6a855c7 commit 95ec5c6

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

drivers/gpu/drm/panel/panel-khadas-ts050.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -821,9 +821,6 @@ static int khadas_ts050_panel_add(struct khadas_ts050_panel *khadas_ts050)
821821
return dev_err_probe(dev, PTR_ERR(khadas_ts050->enable_gpio),
822822
"failed to get enable gpio");
823823

824-
drm_panel_init(&khadas_ts050->base, &khadas_ts050->link->dev,
825-
&khadas_ts050_panel_funcs, DRM_MODE_CONNECTOR_DSI);
826-
827824
err = drm_panel_of_backlight(&khadas_ts050->base);
828825
if (err)
829826
return err;
@@ -850,10 +847,12 @@ static int khadas_ts050_panel_probe(struct mipi_dsi_device *dsi)
850847
dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
851848
MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET;
852849

853-
khadas_ts050 = devm_kzalloc(&dsi->dev, sizeof(*khadas_ts050),
854-
GFP_KERNEL);
855-
if (!khadas_ts050)
856-
return -ENOMEM;
850+
khadas_ts050 = devm_drm_panel_alloc(&dsi->dev, __typeof(*khadas_ts050),
851+
base, &khadas_ts050_panel_funcs,
852+
DRM_MODE_CONNECTOR_DSI);
853+
854+
if (IS_ERR(khadas_ts050))
855+
return PTR_ERR(khadas_ts050);
857856

858857
khadas_ts050->panel_data = (struct khadas_ts050_panel_data *)data;
859858
mipi_dsi_set_drvdata(dsi, khadas_ts050);

0 commit comments

Comments
 (0)