Skip to content

Commit 1e57377

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

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,6 @@ static int sharp_panel_add(struct sharp_panel *sharp)
279279
if (IS_ERR(sharp->supply))
280280
return PTR_ERR(sharp->supply);
281281

282-
drm_panel_init(&sharp->base, &sharp->link1->dev, &sharp_panel_funcs,
283-
DRM_MODE_CONNECTOR_DSI);
284-
285282
ret = drm_panel_of_backlight(&sharp->base);
286283
if (ret)
287284
return ret;
@@ -323,10 +320,12 @@ static int sharp_panel_probe(struct mipi_dsi_device *dsi)
323320

324321
/* register a panel for only the DSI-LINK1 interface */
325322
if (secondary) {
326-
sharp = devm_kzalloc(&dsi->dev, sizeof(*sharp), GFP_KERNEL);
327-
if (!sharp) {
323+
sharp = devm_drm_panel_alloc(&dsi->dev, __typeof(*sharp), base,
324+
&sharp_panel_funcs,
325+
DRM_MODE_CONNECTOR_DSI);
326+
if (IS_ERR(sharp)) {
328327
put_device(&secondary->dev);
329-
return -ENOMEM;
328+
return PTR_ERR(sharp);
330329
}
331330

332331
mipi_dsi_set_drvdata(dsi, sharp);

0 commit comments

Comments
 (0)