drm/i915: Use shorter route to dev_private where possible
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Thu, 17 Mar 2016 13:04:10 +0000 (13:04 +0000)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Fri, 18 Mar 2016 09:50:37 +0000 (09:50 +0000)
Where we have a request we can use req->i915 directly instead
of going through the engine and device. Coccinelle script:

@@
function f;
identifier r;
@@
f(..., struct drm_i915_gem_request *r, ...)
{
...
- engine->dev->dev_private
+ r->i915
...
}
@@
struct drm_i915_gem_request *req;
@@
(
  req->
- engine->dev->dev_private
+ i915
)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1458219850-21007-1-git-send-email-tvrtko.ursulin@linux.intel.com
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_context.c
drivers/gpu/drm/i915/i915_gem_gtt.c
drivers/gpu/drm/i915/intel_lrc.c
drivers/gpu/drm/i915/intel_ringbuffer.c

index 85963b0407b2de4cbd26390150e8bff8e46686ce..f45856d7084cf9943168a3d8a8e2e997e465fcb8 100644 (file)
@@ -2550,7 +2550,7 @@ void __i915_add_request(struct drm_i915_gem_request *request,
                return;
 
        engine = request->engine;
-       dev_priv = engine->dev->dev_private;
+       dev_priv = request->i915;
        ringbuf = request->ringbuf;
 
        /*
index c114665a24b3d1dfae07e2f03d6692f81ac4b705..6627bbe9ea24b4494b6df925530f5ae095011129 100644 (file)
@@ -656,7 +656,7 @@ static int do_switch(struct drm_i915_gem_request *req)
 {
        struct intel_context *to = req->ctx;
        struct intel_engine_cs *engine = req->engine;
-       struct drm_i915_private *dev_priv = engine->dev->dev_private;
+       struct drm_i915_private *dev_priv = req->i915;
        struct intel_context *from = engine->last_context;
        u32 hw_flags = 0;
        bool uninitialized = false;
@@ -829,7 +829,7 @@ unpin_out:
 int i915_switch_context(struct drm_i915_gem_request *req)
 {
        struct intel_engine_cs *engine = req->engine;
-       struct drm_i915_private *dev_priv = engine->dev->dev_private;
+       struct drm_i915_private *dev_priv = req->i915;
 
        WARN_ON(i915.enable_execlists);
        WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex));
index 9c752fe0f730773697162d3a9901e5ffa847e17f..fb0f9637d46f17c2a47d42cedc9aff5e29695bfc 100644 (file)
@@ -2192,7 +2192,7 @@ int i915_ppgtt_init_hw(struct drm_device *dev)
 
 int i915_ppgtt_init_ring(struct drm_i915_gem_request *req)
 {
-       struct drm_i915_private *dev_priv = req->engine->dev->dev_private;
+       struct drm_i915_private *dev_priv = req->i915;
        struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt;
 
        if (i915.enable_execlists)
index f7278220022622bff3e4fb6af9993e1149ab7485..7c636b3db156320dd5c078e5d27bfe1bb0fa4c42 100644 (file)
@@ -897,7 +897,7 @@ int intel_logical_ring_begin(struct drm_i915_gem_request *req, int num_dwords)
        int ret;
 
        WARN_ON(req == NULL);
-       dev_priv = req->engine->dev->dev_private;
+       dev_priv = req->i915;
 
        ret = i915_gem_check_wedge(&dev_priv->gpu_error,
                                   dev_priv->mm.interruptible);
index 015dc7db32b7171537fc4c76902446dfd2b052f8..b7c8fc1a73a3811dfb73012f44a0a80c901305f9 100644 (file)
@@ -2499,7 +2499,7 @@ int intel_ring_begin(struct drm_i915_gem_request *req,
 
        WARN_ON(req == NULL);
        engine = req->engine;
-       dev_priv = engine->dev->dev_private;
+       dev_priv = req->i915;
 
        ret = i915_gem_check_wedge(&dev_priv->gpu_error,
                                   dev_priv->mm.interruptible);