Commit 8aa20195 authored by Danilo Krummrich's avatar Danilo Krummrich Committed by Liviu Dudau

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: default avatarDanilo Krummrich <dakr@redhat.com>
Signed-off-by: default avatarLiviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221026153431.72033-4-dakr@redhat.com
parent 5f56e596
...@@ -289,7 +289,6 @@ static const struct drm_plane_helper_funcs hdlcd_plane_helper_funcs = { ...@@ -289,7 +289,6 @@ static const struct drm_plane_helper_funcs hdlcd_plane_helper_funcs = {
static const struct drm_plane_funcs hdlcd_plane_funcs = { static const struct drm_plane_funcs hdlcd_plane_funcs = {
.update_plane = drm_atomic_helper_update_plane, .update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane, .disable_plane = drm_atomic_helper_disable_plane,
.destroy = drm_plane_cleanup,
.reset = drm_atomic_helper_plane_reset, .reset = drm_atomic_helper_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
...@@ -300,21 +299,16 @@ static struct drm_plane *hdlcd_plane_init(struct drm_device *drm) ...@@ -300,21 +299,16 @@ static struct drm_plane *hdlcd_plane_init(struct drm_device *drm)
struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm); struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm);
struct drm_plane *plane = NULL; struct drm_plane *plane = NULL;
u32 formats[ARRAY_SIZE(supported_formats)], i; u32 formats[ARRAY_SIZE(supported_formats)], i;
int ret;
plane = devm_kzalloc(drm->dev, sizeof(*plane), GFP_KERNEL);
if (!plane)
return ERR_PTR(-ENOMEM);
for (i = 0; i < ARRAY_SIZE(supported_formats); i++) for (i = 0; i < ARRAY_SIZE(supported_formats); i++)
formats[i] = supported_formats[i].fourcc; formats[i] = supported_formats[i].fourcc;
ret = drm_universal_plane_init(drm, plane, 0xff, &hdlcd_plane_funcs, plane = drmm_universal_plane_alloc(drm, struct drm_plane, dev, 0xff,
formats, ARRAY_SIZE(formats), &hdlcd_plane_funcs,
NULL, formats, ARRAY_SIZE(formats),
DRM_PLANE_TYPE_PRIMARY, NULL); NULL, DRM_PLANE_TYPE_PRIMARY, NULL);
if (ret) if (IS_ERR(plane))
return ERR_PTR(ret); return plane;
drm_plane_helper_add(plane, &hdlcd_plane_helper_funcs); drm_plane_helper_add(plane, &hdlcd_plane_helper_funcs);
hdlcd->plane = plane; hdlcd->plane = plane;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment