Commit 3637af92 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov

drm/msm/dpu: use drmm-managed allocation for dpu_crtc

Change struct dpu_crtc allocation to use drmm_crtc_alloc_with_planes().
This removes the need to perform any actions on CRTC destruction.
Reviewed-by: default avatarJessica Zhang <quic_jesszhan@quicinc.com>
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/570054/
Link: https://lore.kernel.org/r/20231201211845.1026967-11-dmitry.baryshkov@linaro.org
parent 0e00f9af
...@@ -51,17 +51,6 @@ static struct dpu_kms *_dpu_crtc_get_kms(struct drm_crtc *crtc) ...@@ -51,17 +51,6 @@ static struct dpu_kms *_dpu_crtc_get_kms(struct drm_crtc *crtc)
return to_dpu_kms(priv->kms); return to_dpu_kms(priv->kms);
} }
static void dpu_crtc_destroy(struct drm_crtc *crtc)
{
struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
if (!crtc)
return;
drm_crtc_cleanup(crtc);
kfree(dpu_crtc);
}
static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc) static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
{ {
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
...@@ -1435,7 +1424,6 @@ static int dpu_crtc_late_register(struct drm_crtc *crtc) ...@@ -1435,7 +1424,6 @@ static int dpu_crtc_late_register(struct drm_crtc *crtc)
static const struct drm_crtc_funcs dpu_crtc_funcs = { static const struct drm_crtc_funcs dpu_crtc_funcs = {
.set_config = drm_atomic_helper_set_config, .set_config = drm_atomic_helper_set_config,
.destroy = dpu_crtc_destroy,
.page_flip = drm_atomic_helper_page_flip, .page_flip = drm_atomic_helper_page_flip,
.reset = dpu_crtc_reset, .reset = dpu_crtc_reset,
.atomic_duplicate_state = dpu_crtc_duplicate_state, .atomic_duplicate_state = dpu_crtc_duplicate_state,
...@@ -1469,9 +1457,13 @@ struct drm_crtc *dpu_crtc_init(struct drm_device *dev, struct drm_plane *plane, ...@@ -1469,9 +1457,13 @@ struct drm_crtc *dpu_crtc_init(struct drm_device *dev, struct drm_plane *plane,
struct dpu_crtc *dpu_crtc; struct dpu_crtc *dpu_crtc;
int i, ret; int i, ret;
dpu_crtc = kzalloc(sizeof(*dpu_crtc), GFP_KERNEL); dpu_crtc = drmm_crtc_alloc_with_planes(dev, struct dpu_crtc, base,
if (!dpu_crtc) plane, cursor,
return ERR_PTR(-ENOMEM); &dpu_crtc_funcs,
NULL);
if (IS_ERR(dpu_crtc))
return ERR_CAST(dpu_crtc);
crtc = &dpu_crtc->base; crtc = &dpu_crtc->base;
crtc->dev = dev; crtc->dev = dev;
...@@ -1491,9 +1483,6 @@ struct drm_crtc *dpu_crtc_init(struct drm_device *dev, struct drm_plane *plane, ...@@ -1491,9 +1483,6 @@ struct drm_crtc *dpu_crtc_init(struct drm_device *dev, struct drm_plane *plane,
dpu_crtc_frame_event_work); dpu_crtc_frame_event_work);
} }
drm_crtc_init_with_planes(dev, crtc, plane, cursor, &dpu_crtc_funcs,
NULL);
drm_crtc_helper_add(crtc, &dpu_crtc_helper_funcs); drm_crtc_helper_add(crtc, &dpu_crtc_helper_funcs);
if (dpu_kms->catalog->dspp_count) if (dpu_kms->catalog->dspp_count)
......
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