Commit d95c196d authored by Rob Clark's avatar Rob Clark

drm/msm/gem: Convert to lockdep assert

Utilize the power of lockdep for our GEM locking related sanity
checking.
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
Patchwork: https://patchwork.freedesktop.org/patch/496139/
Link: https://lore.kernel.org/r/20220802155152.1727594-16-robdclark@gmail.com
parent d4d7d363
...@@ -197,8 +197,8 @@ msm_gem_unlock(struct drm_gem_object *obj) ...@@ -197,8 +197,8 @@ msm_gem_unlock(struct drm_gem_object *obj)
dma_resv_unlock(obj->resv); dma_resv_unlock(obj->resv);
} }
static inline bool static inline void
msm_gem_is_locked(struct drm_gem_object *obj) msm_gem_assert_locked(struct drm_gem_object *obj)
{ {
/* /*
* Destroying the object is a special case.. msm_gem_free_object() * Destroying the object is a special case.. msm_gem_free_object()
...@@ -212,13 +212,10 @@ msm_gem_is_locked(struct drm_gem_object *obj) ...@@ -212,13 +212,10 @@ msm_gem_is_locked(struct drm_gem_object *obj)
* Unfortunately lockdep is not aware of this detail. So when the * Unfortunately lockdep is not aware of this detail. So when the
* refcount drops to zero, we pretend it is already locked. * refcount drops to zero, we pretend it is already locked.
*/ */
return dma_resv_is_locked(obj->resv) || (kref_read(&obj->refcount) == 0); lockdep_assert_once(
} (kref_read(&obj->refcount) == 0) ||
(lockdep_is_held(&obj->resv->lock.base) != LOCK_STATE_NOT_HELD)
static inline void );
msm_gem_assert_locked(struct drm_gem_object *obj)
{
GEM_WARN_ON(!msm_gem_is_locked(obj));
} }
/* imported/exported objects are not purgeable: */ /* imported/exported objects are not purgeable: */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment