drm/rockchip: Convert to using __drm_atomic_helper_crtc_reset() for reset.
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fri, 1 Mar 2019 12:56:23 +0000 (13:56 +0100)
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Thu, 25 Apr 2019 09:02:04 +0000 (11:02 +0200)
Convert rockchip 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.lankhorst@linux.intel.com>
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: "Heiko Stübner" <heiko@sntech.de>
Cc: linux-rockchip@lists.infradead.org
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20190301125627.7285-14-maarten.lankhorst@linux.intel.com
drivers/gpu/drm/rockchip/rockchip_drm_vop.c

index a7cbf6c9a1531722b79e044bed478d6bdc724a4f..9254747ef65b97e2731594cb47ee9ab7d85d8456 100644 (file)
@@ -1210,17 +1210,6 @@ static void vop_crtc_destroy(struct drm_crtc *crtc)
        drm_crtc_cleanup(crtc);
 }
 
-static void vop_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 rockchip_crtc_state), GFP_KERNEL);
-       if (crtc->state)
-               crtc->state->crtc = crtc;
-}
-
 static struct drm_crtc_state *vop_crtc_duplicate_state(struct drm_crtc *crtc)
 {
        struct rockchip_crtc_state *rockchip_state;
@@ -1242,6 +1231,17 @@ static void vop_crtc_destroy_state(struct drm_crtc *crtc,
        kfree(s);
 }
 
+static void vop_crtc_reset(struct drm_crtc *crtc)
+{
+       struct rockchip_crtc_state *crtc_state =
+               kzalloc(sizeof(*crtc_state), GFP_KERNEL);
+
+       if (crtc->state)
+               vop_crtc_destroy_state(crtc, crtc->state);
+
+       __drm_atomic_helper_crtc_reset(crtc, &crtc_state->base);
+}
+
 #ifdef CONFIG_DRM_ANALOGIX_DP
 static struct drm_connector *vop_get_edp_connector(struct vop *vop)
 {