drm/atomic: Call ww_acquire_done after check phase is complete
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 6 Aug 2015 13:06:40 +0000 (15:06 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 11 Aug 2015 10:04:18 +0000 (12:04 +0200)
We want to make sure that no one tries to acquire more locks and
states, and ww mutexes provide debug facilities for that. So use them.

v2: Only call acquire_done when ->atomic_check was successful to avoid
falling over an -EDEADLK (spotted by Maarten).

Cc: Rob Clark <robdclark@gmail.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
drivers/gpu/drm/drm_atomic.c

index 434915448ea0be99b7786c6daf2650cfb93b728a..1066e4b658cf9a341c1955fb34f82040a4be909c 100644 (file)
@@ -1230,6 +1230,9 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
                }
        }
 
+       if (ret == 0)
+               ww_acquire_done(&state->acquire_ctx->ww_ctx);
+
        return ret;
 }
 EXPORT_SYMBOL(drm_atomic_check_only);