Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/panel/raspberrypi: 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-2-de73ba81b2f5@redhat.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>

authored by

Anusha Srivatsa and committed by
Maxime Ripard
6299cb4a 1e57377d

+6 -6
+6 -6
drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
··· 373 373 .node = NULL, 374 374 }; 375 375 376 - ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); 377 - if (!ts) 378 - return -ENOMEM; 376 + ts = devm_drm_panel_alloc(dev, __typeof(*ts), base, 377 + &rpi_touchscreen_funcs, 378 + DRM_MODE_CONNECTOR_DSI); 379 + 380 + if (IS_ERR(ts)) 381 + return PTR_ERR(ts); 379 382 380 383 i2c_set_clientdata(i2c, ts); 381 384 ··· 430 427 PTR_ERR(ts->dsi)); 431 428 return PTR_ERR(ts->dsi); 432 429 } 433 - 434 - drm_panel_init(&ts->base, dev, &rpi_touchscreen_funcs, 435 - DRM_MODE_CONNECTOR_DSI); 436 430 437 431 /* This appears last, as it's what will unblock the DSI host 438 432 * driver's component bind function.