Convert omap to using __drm_atomic_helper_crtc_reset(), instead of
writing its own version. Instead of open coding
destroy_state(), call it directly for freeing the old state.

Signed-off-by: Maarten Lankhorst <maarten.lankho...@linux.intel.com>
Cc: Tomi Valkeinen <tomi.valkei...@ti.com>
---
 drivers/gpu/drm/omapdrm/omap_crtc.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
b/drivers/gpu/drm/omapdrm/omap_crtc.c
index d99e24dcc0bf..2546002b1c5c 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -549,14 +549,13 @@ static int omap_crtc_atomic_get_property(struct drm_crtc 
*crtc,
 
 static void omap_crtc_reset(struct drm_crtc *crtc)
 {
-       if (crtc->state)
-               __drm_atomic_helper_crtc_destroy_state(crtc->state);
-
-       kfree(crtc->state);
-       crtc->state = kzalloc(sizeof(struct omap_crtc_state), GFP_KERNEL);
+       struct omap_crtc_state *crtc_state =
+               kzalloc(sizeof(*crtc_state), GFP_KERNEL);
 
        if (crtc->state)
-               crtc->state->crtc = crtc;
+               drm_atomic_helper_crtc_destroy_state(crtc, crtc->state);
+
+       __drm_atomic_helper_crtc_reset(crtc, &crtc_state->base);
 }
 
 static struct drm_crtc_state *
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to