[PATCH 17/17] drm/vmwgfx: Convert to using __drm_atomic_helper_crtc_reset() for reset.
Maarten Lankhorst
maarten.lankhorst at linux.intel.com
Fri Mar 1 12:56:27 UTC 2019
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 at linux.intel.com>
Cc: Thomas Hellstrom <thellstrom at vmware.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
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);
}
--
2.20.1
More information about the dri-devel
mailing list