@@ -285,6 +285,10 @@ static inline void __intel_context_pin(struct intel_context *ce)
static inline void intel_context_unpin(struct intel_context *ce)
{
+ GEM_BUG_ON(!ce->pin_count);
+ if (--ce->pin_count)
+ return;
+
GEM_BUG_ON(!ce->ops);
ce->ops->unpin(ce);
}
@@ -1342,7 +1342,7 @@ static void execlists_context_destroy(struct intel_context *ce)
__i915_gem_object_release_unless_active(ce->state->obj);
}
-static void __execlists_context_unpin(struct intel_context *ce)
+static void execlists_context_unpin(struct intel_context *ce)
{
intel_ring_unpin(ce->ring);
@@ -1353,17 +1353,6 @@ static void __execlists_context_unpin(struct intel_context *ce)
i915_gem_context_put(ce->gem_context);
}
-static void execlists_context_unpin(struct intel_context *ce)
-{
- lockdep_assert_held(&ce->gem_context->i915->drm.struct_mutex);
- GEM_BUG_ON(ce->pin_count == 0);
-
- if (--ce->pin_count)
- return;
-
- __execlists_context_unpin(ce);
-}
-
static int __context_pin(struct i915_gem_context *ctx, struct i915_vma *vma)
{
unsigned int flags;
@@ -1195,12 +1195,6 @@ static void intel_ring_context_destroy(struct intel_context *ce)
static void intel_ring_context_unpin(struct intel_context *ce)
{
- lockdep_assert_held(&ce->gem_context->i915->drm.struct_mutex);
- GEM_BUG_ON(ce->pin_count == 0);
-
- if (--ce->pin_count)
- return;
-
if (ce->state) {
ce->state->obj->pin_global--;
i915_vma_unpin(ce->state);
@@ -74,9 +74,6 @@ static void hw_delay_complete(struct timer_list *t)
static void mock_context_unpin(struct intel_context *ce)
{
- if (--ce->pin_count)
- return;
-
i915_gem_context_put(ce->gem_context);
}