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

drm/arm/hdlcd: plane: use drm managed resources

Use drm managed resource allocation (drmm_universal_plane_alloc()) in
order to get rid of the explicit destroy hook in struct drm_plane_funcs.

Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221026153431.72033-4-dakr@redhat.com

authored by

Danilo Krummrich and committed by
Liviu Dudau
8aa20195 5f56e596

+6 -12
+6 -12
drivers/gpu/drm/arm/hdlcd_crtc.c
··· 289 289 static const struct drm_plane_funcs hdlcd_plane_funcs = { 290 290 .update_plane = drm_atomic_helper_update_plane, 291 291 .disable_plane = drm_atomic_helper_disable_plane, 292 - .destroy = drm_plane_cleanup, 293 292 .reset = drm_atomic_helper_plane_reset, 294 293 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, 295 294 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, ··· 299 300 struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm); 300 301 struct drm_plane *plane = NULL; 301 302 u32 formats[ARRAY_SIZE(supported_formats)], i; 302 - int ret; 303 - 304 - plane = devm_kzalloc(drm->dev, sizeof(*plane), GFP_KERNEL); 305 - if (!plane) 306 - return ERR_PTR(-ENOMEM); 307 303 308 304 for (i = 0; i < ARRAY_SIZE(supported_formats); i++) 309 305 formats[i] = supported_formats[i].fourcc; 310 306 311 - ret = drm_universal_plane_init(drm, plane, 0xff, &hdlcd_plane_funcs, 312 - formats, ARRAY_SIZE(formats), 313 - NULL, 314 - DRM_PLANE_TYPE_PRIMARY, NULL); 315 - if (ret) 316 - return ERR_PTR(ret); 307 + plane = drmm_universal_plane_alloc(drm, struct drm_plane, dev, 0xff, 308 + &hdlcd_plane_funcs, 309 + formats, ARRAY_SIZE(formats), 310 + NULL, DRM_PLANE_TYPE_PRIMARY, NULL); 311 + if (IS_ERR(plane)) 312 + return plane; 317 313 318 314 drm_plane_helper_add(plane, &hdlcd_plane_helper_funcs); 319 315 hdlcd->plane = plane;