drm/i915: Simplify releasing context reference

A few users only take the struct_mutex in order to release a reference
to a context. We can expose a kref_put_mutex() wrapper in order to
simplify these users, and optimise taking of the mutex to the final
unref.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161218153724.8439-4-chris@chris-wilson.co.uk
Šī revīzija ir iekļauta:
Chris Wilson
2016-12-18 15:37:21 +00:00
vecāks e8a9c58fcd
revīzija 69df05e11a
2 mainīti faili ar 11 papildinājumiem un 12 dzēšanām

Parādīt failu

@@ -3518,6 +3518,13 @@ static inline void i915_gem_context_put(struct i915_gem_context *ctx)
kref_put(&ctx->ref, i915_gem_context_free);
}
static inline void i915_gem_context_put_unlocked(struct i915_gem_context *ctx)
{
kref_put_mutex(&ctx->ref,
i915_gem_context_free,
&ctx->i915->drm.struct_mutex);
}
static inline struct intel_timeline *
i915_gem_context_lookup_timeline(struct i915_gem_context *ctx,
struct intel_engine_cs *engine)