Skip to content

Commit 3ad5103

Browse files
dakrdliviu
authored andcommitted
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 <[email protected]> Signed-off-by: Liviu Dudau <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 905ff16 commit 3ad5103

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

drivers/gpu/drm/arm/malidp_planes.c

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@
6868
/* readahead for partial-frame prefetch */
6969
#define MALIDP_MMU_PREFETCH_READAHEAD 8
7070

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-
7971
/*
8072
* Replicate what the default ->reset hook does: free the state pointer and
8173
* allocate a new empty object. We just need enough space to store
@@ -260,7 +252,6 @@ static bool malidp_format_mod_supported_per_plane(struct drm_plane *plane,
260252
static const struct drm_plane_funcs malidp_de_plane_funcs = {
261253
.update_plane = drm_atomic_helper_update_plane,
262254
.disable_plane = drm_atomic_helper_disable_plane,
263-
.destroy = malidp_de_plane_destroy,
264255
.reset = malidp_plane_reset,
265256
.atomic_duplicate_state = malidp_duplicate_plane_state,
266257
.atomic_destroy_state = malidp_destroy_plane_state,
@@ -972,12 +963,6 @@ int malidp_de_planes_init(struct drm_device *drm)
972963
for (i = 0; i < map->n_layers; i++) {
973964
u8 id = map->layers[i].id;
974965

975-
plane = kzalloc(sizeof(*plane), GFP_KERNEL);
976-
if (!plane) {
977-
ret = -ENOMEM;
978-
goto cleanup;
979-
}
980-
981966
/* build the list of DRM supported formats based on the map */
982967
for (n = 0, j = 0; j < map->n_pixel_formats; j++) {
983968
if ((map->pixel_formats[j].layer & id) == id)
@@ -990,13 +975,14 @@ int malidp_de_planes_init(struct drm_device *drm)
990975
/*
991976
* All the layers except smart layer supports AFBC modifiers.
992977
*/
993-
ret = drm_universal_plane_init(drm, &plane->base, crtcs,
994-
&malidp_de_plane_funcs, formats, n,
995-
(id == DE_SMART) ? linear_only_modifiers : modifiers,
996-
plane_type, NULL);
997-
998-
if (ret < 0)
978+
plane = drmm_universal_plane_alloc(drm, struct malidp_plane, base,
979+
crtcs, &malidp_de_plane_funcs, formats, n,
980+
(id == DE_SMART) ? linear_only_modifiers :
981+
modifiers, plane_type, NULL);
982+
if (IS_ERR(plane)) {
983+
ret = PTR_ERR(plane);
999984
goto cleanup;
985+
}
1000986

1001987
drm_plane_helper_add(&plane->base,
1002988
&malidp_de_plane_helper_funcs);

0 commit comments

Comments
 (0)