Unverified Commit 95ec5c60 authored by Anusha Srivatsa's avatar Anusha Srivatsa Committed by Maxime Ripard
Browse files

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: default avatarAnusha 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: default avatarMaxime Ripard <mripard@kernel.org>
parent 6a855c7f
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -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);