[17/17] drm/vmwgfx: Convert to using __drm_atomic_helper_crtc_reset() for reset.
diff mbox series

Message ID 20190301125627.7285-18-maarten.lankhorst@linux.intel.com
State New
Headers show
Series
  • drm: Start subclassing crtc_state.
Related show

Commit Message

Maarten Lankhorst March 1, 2019, 12:56 p.m. UTC
Convert vmwgfx 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: Thomas Hellstrom <thellstrom@vmware.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

Patch
diff mbox series

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index ed2f67822f45..602f549f09f6 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -611,24 +611,12 @@  vmw_du_crtc_duplicate_state(struct drm_crtc *crtc)
  */
 void vmw_du_crtc_reset(struct drm_crtc *crtc)
 {
-	struct vmw_crtc_state *vcs;
-
-
-	if (crtc->state) {
-		__drm_atomic_helper_crtc_destroy_state(crtc->state);
-
-		kfree(vmw_crtc_state_to_vcs(crtc->state));
-	}
+	struct vmw_crtc_state *vcs = kzalloc(sizeof(*vcs), GFP_KERNEL);
 
-	vcs = kzalloc(sizeof(*vcs), GFP_KERNEL);
-
-	if (!vcs) {
-		DRM_ERROR("Cannot allocate vmw_crtc_state\n");
-		return;
-	}
+	if (crtc->state)
+		vmw_du_crtc_destroy_state(crtc, crtc->state);
 
-	crtc->state = &vcs->base;
-	crtc->state->crtc = crtc;
+	__drm_atomic_helper_crtc_reset(crtc, &vcs->base);
 }