Skip to content

Commit 8aa2019

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

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

drivers/gpu/drm/arm/hdlcd_crtc.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ static const struct drm_plane_helper_funcs hdlcd_plane_helper_funcs = {
289289
static const struct drm_plane_funcs hdlcd_plane_funcs = {
290290
.update_plane = drm_atomic_helper_update_plane,
291291
.disable_plane = drm_atomic_helper_disable_plane,
292-
.destroy = drm_plane_cleanup,
293292
.reset = drm_atomic_helper_plane_reset,
294293
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
295294
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
@@ -300,21 +299,16 @@ static struct drm_plane *hdlcd_plane_init(struct drm_device *drm)
300299
struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm);
301300
struct drm_plane *plane = NULL;
302301
u32 formats[ARRAY_SIZE(supported_formats)], i;
303-
int ret;
304-
305-
plane = devm_kzalloc(drm->dev, sizeof(*plane), GFP_KERNEL);
306-
if (!plane)
307-
return ERR_PTR(-ENOMEM);
308302

309303
for (i = 0; i < ARRAY_SIZE(supported_formats); i++)
310304
formats[i] = supported_formats[i].fourcc;
311305

312-
ret = drm_universal_plane_init(drm, plane, 0xff, &hdlcd_plane_funcs,
313-
formats, ARRAY_SIZE(formats),
314-
NULL,
315-
DRM_PLANE_TYPE_PRIMARY, NULL);
316-
if (ret)
317-
return ERR_PTR(ret);
306+
plane = drmm_universal_plane_alloc(drm, struct drm_plane, dev, 0xff,
307+
&hdlcd_plane_funcs,
308+
formats, ARRAY_SIZE(formats),
309+
NULL, DRM_PLANE_TYPE_PRIMARY, NULL);
310+
if (IS_ERR(plane))
311+
return plane;
318312

319313
drm_plane_helper_add(plane, &hdlcd_plane_helper_funcs);
320314
hdlcd->plane = plane;

0 commit comments

Comments
 (0)