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

drm/arm/malidp: 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/20221026155934.125294-5-dakr@redhat.com

authored by

Danilo Krummrich and committed by
Liviu Dudau
3ad51034 905ff163

+7 -21
+7 -21
drivers/gpu/drm/arm/malidp_planes.c
··· 68 68 /* readahead for partial-frame prefetch */ 69 69 #define MALIDP_MMU_PREFETCH_READAHEAD 8 70 70 71 - static void malidp_de_plane_destroy(struct drm_plane *plane) 72 - { 73 - struct malidp_plane *mp = to_malidp_plane(plane); 74 - 75 - drm_plane_cleanup(plane); 76 - kfree(mp); 77 - } 78 - 79 71 /* 80 72 * Replicate what the default ->reset hook does: free the state pointer and 81 73 * allocate a new empty object. We just need enough space to store ··· 252 260 static const struct drm_plane_funcs malidp_de_plane_funcs = { 253 261 .update_plane = drm_atomic_helper_update_plane, 254 262 .disable_plane = drm_atomic_helper_disable_plane, 255 - .destroy = malidp_de_plane_destroy, 256 263 .reset = malidp_plane_reset, 257 264 .atomic_duplicate_state = malidp_duplicate_plane_state, 258 265 .atomic_destroy_state = malidp_destroy_plane_state, ··· 963 972 for (i = 0; i < map->n_layers; i++) { 964 973 u8 id = map->layers[i].id; 965 974 966 - plane = kzalloc(sizeof(*plane), GFP_KERNEL); 967 - if (!plane) { 968 - ret = -ENOMEM; 969 - goto cleanup; 970 - } 971 - 972 975 /* build the list of DRM supported formats based on the map */ 973 976 for (n = 0, j = 0; j < map->n_pixel_formats; j++) { 974 977 if ((map->pixel_formats[j].layer & id) == id) ··· 975 990 /* 976 991 * All the layers except smart layer supports AFBC modifiers. 977 992 */ 978 - ret = drm_universal_plane_init(drm, &plane->base, crtcs, 979 - &malidp_de_plane_funcs, formats, n, 980 - (id == DE_SMART) ? linear_only_modifiers : modifiers, 981 - plane_type, NULL); 982 - 983 - if (ret < 0) 993 + plane = drmm_universal_plane_alloc(drm, struct malidp_plane, base, 994 + crtcs, &malidp_de_plane_funcs, formats, n, 995 + (id == DE_SMART) ? linear_only_modifiers : 996 + modifiers, plane_type, NULL); 997 + if (IS_ERR(plane)) { 998 + ret = PTR_ERR(plane); 984 999 goto cleanup; 1000 + } 985 1001 986 1002 drm_plane_helper_add(&plane->base, 987 1003 &malidp_de_plane_helper_funcs);