Skip to content

Commit 6a855c7

Browse files
anushasrivatsmripard
authored andcommitted
drm/panel/kd097d04: 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-7-de73ba81b2f5@redhat.com Signed-off-by: Maxime Ripard <[email protected]>
1 parent daeca2b commit 6a855c7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,6 @@ static int kingdisplay_panel_add(struct kingdisplay_panel *kingdisplay)
337337
kingdisplay->enable_gpio = NULL;
338338
}
339339

340-
drm_panel_init(&kingdisplay->base, &kingdisplay->link->dev,
341-
&kingdisplay_panel_funcs, DRM_MODE_CONNECTOR_DSI);
342-
343340
err = drm_panel_of_backlight(&kingdisplay->base);
344341
if (err)
345342
return err;
@@ -364,9 +361,12 @@ static int kingdisplay_panel_probe(struct mipi_dsi_device *dsi)
364361
dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
365362
MIPI_DSI_MODE_LPM;
366363

367-
kingdisplay = devm_kzalloc(&dsi->dev, sizeof(*kingdisplay), GFP_KERNEL);
368-
if (!kingdisplay)
369-
return -ENOMEM;
364+
kingdisplay = devm_drm_panel_alloc(&dsi->dev, __typeof(*kingdisplay), base,
365+
&kingdisplay_panel_funcs,
366+
DRM_MODE_CONNECTOR_DSI);
367+
368+
if (IS_ERR(kingdisplay))
369+
return PTR_ERR(kingdisplay);
370370

371371
mipi_dsi_set_drvdata(dsi, kingdisplay);
372372
kingdisplay->link = dsi;

0 commit comments

Comments
 (0)