]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Compartmentalize i915_ggtt_probe_hw
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Fri, 21 Jun 2019 07:07:56 +0000 (08:07 +0100)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Fri, 21 Jun 2019 12:48:33 +0000 (13:48 +0100)
Having made start to better code compartmentalization by introducing
struct intel_gt, continue the theme elsewhere in code by making functions
take parameters take what logically makes most sense for them instead of
the global struct drm_i915_private.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190621070811.7006-18-tvrtko.ursulin@linux.intel.com
drivers/gpu/drm/i915/i915_gem_gtt.c

index 7c543e067623d69ac4873c43b7784d318339e77c..629683c52e508bccfdb24a33186e0f0fa871963e 100644 (file)
@@ -3457,21 +3457,16 @@ static int i915_gmch_probe(struct i915_ggtt *ggtt)
        return 0;
 }
 
-/**
- * i915_ggtt_probe_hw - Probe GGTT hardware location
- * @dev_priv: i915 device
- */
-int i915_ggtt_probe_hw(struct drm_i915_private *dev_priv)
+static int ggtt_probe_hw(struct i915_ggtt *ggtt, struct drm_i915_private *i915)
 {
-       struct i915_ggtt *ggtt = &dev_priv->ggtt;
        int ret;
 
-       ggtt->vm.i915 = dev_priv;
-       ggtt->vm.dma = &dev_priv->drm.pdev->dev;
+       ggtt->vm.i915 = i915;
+       ggtt->vm.dma = &i915->drm.pdev->dev;
 
-       if (INTEL_GEN(dev_priv) <= 5)
+       if (INTEL_GEN(i915) <= 5)
                ret = i915_gmch_probe(ggtt);
-       else if (INTEL_GEN(dev_priv) < 8)
+       else if (INTEL_GEN(i915) < 8)
                ret = gen6_gmch_probe(ggtt);
        else
                ret = gen8_gmch_probe(ggtt);
@@ -3499,6 +3494,22 @@ int i915_ggtt_probe_hw(struct drm_i915_private *dev_priv)
        DRM_DEBUG_DRIVER("GMADR size = %lluM\n", (u64)ggtt->mappable_end >> 20);
        DRM_DEBUG_DRIVER("DSM size = %lluM\n",
                         (u64)resource_size(&intel_graphics_stolen_res) >> 20);
+
+       return 0;
+}
+
+/**
+ * i915_ggtt_probe_hw - Probe GGTT hardware location
+ * @dev_priv: i915 device
+ */
+int i915_ggtt_probe_hw(struct drm_i915_private *i915)
+{
+       int ret;
+
+       ret = ggtt_probe_hw(&i915->ggtt, i915);
+       if (ret)
+               return ret;
+
        if (intel_vtd_active())
                DRM_INFO("VT-d active for gfx access\n");