drm/i915/guc: prefer 'dev_priv' to 'dev' for intra-module functions
authorDave Gordon <david.s.gordon@intel.com>
Fri, 10 Jun 2016 17:29:26 +0000 (18:29 +0100)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Mon, 13 Jun 2016 15:47:39 +0000 (16:47 +0100)
There are four non-static functions in i915_guc_submission.c that take a
'dev' parameter. All are called only from GuC loader code, and can be
easily converted to accept 'dev_priv' instead.

Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1465579766-31595-1-git-send-email-david.s.gordon@intel.com
drivers/gpu/drm/i915/i915_guc_submission.c
drivers/gpu/drm/i915/intel_guc.h
drivers/gpu/drm/i915/intel_guc_loader.c

index 1bd0fac2ce94528ffd260c1e43673ac1573b67ca..65e67f0f0e91764ad87597299683be5d80cb31e7 100644 (file)
@@ -906,9 +906,8 @@ static void guc_create_ads(struct intel_guc *guc)
  * Set up the memory resources to be shared with the GuC.  At this point,
  * we require just one object that can be mapped through the GGTT.
  */
-int i915_guc_submission_init(struct drm_device *dev)
+int i915_guc_submission_init(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = dev->dev_private;
        const size_t ctxsize = sizeof(struct guc_context_desc);
        const size_t poolsize = GUC_MAX_GPU_CONTEXTS * ctxsize;
        const size_t gemsize = round_up(poolsize, PAGE_SIZE);
@@ -916,7 +915,7 @@ int i915_guc_submission_init(struct drm_device *dev)
 
        /* Wipe bitmap & delete client in case of reinitialisation */
        bitmap_clear(guc->doorbell_bitmap, 0, GUC_MAX_DOORBELLS);
-       i915_guc_submission_disable(dev);
+       i915_guc_submission_disable(dev_priv);
 
        if (!i915.enable_guc_submission)
                return 0; /* not enabled  */
@@ -935,9 +934,8 @@ int i915_guc_submission_init(struct drm_device *dev)
        return 0;
 }
 
-int i915_guc_submission_enable(struct drm_device *dev)
+int i915_guc_submission_enable(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_guc *guc = &dev_priv->guc;
        struct i915_guc_client *client;
 
@@ -957,18 +955,16 @@ int i915_guc_submission_enable(struct drm_device *dev)
        return 0;
 }
 
-void i915_guc_submission_disable(struct drm_device *dev)
+void i915_guc_submission_disable(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_guc *guc = &dev_priv->guc;
 
        guc_client_free(dev_priv, guc->execbuf_client);
        guc->execbuf_client = NULL;
 }
 
-void i915_guc_submission_fini(struct drm_device *dev)
+void i915_guc_submission_fini(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_guc *guc = &dev_priv->guc;
 
        gem_release_guc_obj(dev_priv->guc.ads_obj);
index 41601c71f5294c18fbcaa651416d24b19c65d4b0..4df80cc9a29168fea10cc79e3531e80efd2ab9f5 100644 (file)
@@ -156,11 +156,11 @@ extern int intel_guc_suspend(struct drm_device *dev);
 extern int intel_guc_resume(struct drm_device *dev);
 
 /* i915_guc_submission.c */
-int i915_guc_submission_init(struct drm_device *dev);
-int i915_guc_submission_enable(struct drm_device *dev);
+int i915_guc_submission_init(struct drm_i915_private *dev_priv);
+int i915_guc_submission_enable(struct drm_i915_private *dev_priv);
 int i915_guc_wq_check_space(struct drm_i915_gem_request *rq);
 int i915_guc_submit(struct drm_i915_gem_request *rq);
-void i915_guc_submission_disable(struct drm_device *dev);
-void i915_guc_submission_fini(struct drm_device *dev);
+void i915_guc_submission_disable(struct drm_i915_private *dev_priv);
+void i915_guc_submission_fini(struct drm_i915_private *dev_priv);
 
 #endif
index 05732e31f6cc1a34e6036cc6c0743c83aee3a485..8fe96a2d989e3ce645913f37d3d2a6dfe6faa2ad 100644 (file)
@@ -453,7 +453,7 @@ int intel_guc_setup(struct drm_device *dev)
                intel_guc_fw_status_repr(guc_fw->guc_fw_fetch_status),
                intel_guc_fw_status_repr(guc_fw->guc_fw_load_status));
 
-       err = i915_guc_submission_init(dev);
+       err = i915_guc_submission_init(dev_priv);
        if (err)
                goto fail;
 
@@ -492,7 +492,7 @@ int intel_guc_setup(struct drm_device *dev)
                intel_guc_fw_status_repr(guc_fw->guc_fw_load_status));
 
        if (i915.enable_guc_submission) {
-               err = i915_guc_submission_enable(dev);
+               err = i915_guc_submission_enable(dev_priv);
                if (err)
                        goto fail;
                direct_interrupts_to_guc(dev_priv);
@@ -505,8 +505,8 @@ fail:
                guc_fw->guc_fw_load_status = GUC_FIRMWARE_FAIL;
 
        direct_interrupts_to_host(dev_priv);
-       i915_guc_submission_disable(dev);
-       i915_guc_submission_fini(dev);
+       i915_guc_submission_disable(dev_priv);
+       i915_guc_submission_fini(dev_priv);
 
        /*
         * We've failed to load the firmware :(
@@ -733,8 +733,8 @@ void intel_guc_fini(struct drm_device *dev)
 
        mutex_lock(&dev->struct_mutex);
        direct_interrupts_to_host(dev_priv);
-       i915_guc_submission_disable(dev);
-       i915_guc_submission_fini(dev);
+       i915_guc_submission_disable(dev_priv);
+       i915_guc_submission_fini(dev_priv);
 
        if (guc_fw->guc_fw_obj)
                drm_gem_object_unreference(&guc_fw->guc_fw_obj->base);