drm/i915: dev_priv cleanup in i915_gem_stolen.c
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Wed, 16 Nov 2016 08:55:35 +0000 (08:55 +0000)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Thu, 17 Nov 2016 13:56:16 +0000 (13:56 +0000)
And a little bit of cascaded function prototype changes.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem_gtt.c
drivers/gpu/drm/i915/i915_gem_stolen.c

index 7cae0d7b7641ccdc1422970a6db6ac588ff6af25..85bca607409c867e226377678aa6ce9a149da4d6 100644 (file)
@@ -3279,7 +3279,7 @@ int i915_gem_stolen_insert_node_in_range(struct drm_i915_private *dev_priv,
                                         u64 end);
 void i915_gem_stolen_remove_node(struct drm_i915_private *dev_priv,
                                 struct drm_mm_node *node);
-int i915_gem_init_stolen(struct drm_device *dev);
+int i915_gem_init_stolen(struct drm_i915_private *dev_priv);
 void i915_gem_cleanup_stolen(struct drm_device *dev);
 struct drm_i915_gem_object *
 i915_gem_object_create_stolen(struct drm_device *dev, u32 size);
index 1334da172945b4ca100e2d75fb0e9e7903a48f07..75a0f2d4e62f2236ee33424aa23898736879f36f 100644 (file)
@@ -3252,7 +3252,7 @@ int i915_ggtt_init_hw(struct drm_i915_private *dev_priv)
         * Initialise stolen early so that we may reserve preallocated
         * objects for the BIOS to KMS transition.
         */
-       ret = i915_gem_init_stolen(&dev_priv->drm);
+       ret = i915_gem_init_stolen(dev_priv);
        if (ret)
                goto out_gtt_cleanup;
 
index 54085df1f2272c49a7ef2010012128eac2f311a9..c1551988dc6cb4109882d65ac7f8d0a25d59f7ed 100644 (file)
@@ -89,9 +89,8 @@ void i915_gem_stolen_remove_node(struct drm_i915_private *dev_priv,
        mutex_unlock(&dev_priv->mm.stolen_lock);
 }
 
-static unsigned long i915_stolen_to_physical(struct drm_device *dev)
+static unsigned long i915_stolen_to_physical(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
        struct pci_dev *pdev = dev_priv->drm.pdev;
        struct i915_ggtt *ggtt = &dev_priv->ggtt;
        struct resource *r;
@@ -253,7 +252,7 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
         * kernel. So if the region is already marked as busy, something
         * is seriously wrong.
         */
-       r = devm_request_mem_region(dev->dev, base, ggtt->stolen_size,
+       r = devm_request_mem_region(dev_priv->drm.dev, base, ggtt->stolen_size,
                                    "Graphics Stolen Memory");
        if (r == NULL) {
                /*
@@ -264,7 +263,7 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
                 * PCI bus, but have an off-by-one error. Hence retry the
                 * reservation starting from 1 instead of 0.
                 */
-               r = devm_request_mem_region(dev->dev, base + 1,
+               r = devm_request_mem_region(dev_priv->drm.dev, base + 1,
                                            ggtt->stolen_size - 1,
                                            "Graphics Stolen Memory");
                /*
@@ -408,9 +407,8 @@ static void bdw_get_stolen_reserved(struct drm_i915_private *dev_priv,
                *size = stolen_top - *base;
 }
 
-int i915_gem_init_stolen(struct drm_device *dev)
+int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
        struct i915_ggtt *ggtt = &dev_priv->ggtt;
        unsigned long reserved_total, reserved_base = 0, reserved_size;
        unsigned long stolen_top;
@@ -418,7 +416,7 @@ int i915_gem_init_stolen(struct drm_device *dev)
        mutex_init(&dev_priv->mm.stolen_lock);
 
 #ifdef CONFIG_INTEL_IOMMU
-       if (intel_iommu_gfx_mapped && INTEL_INFO(dev)->gen < 8) {
+       if (intel_iommu_gfx_mapped && INTEL_GEN(dev_priv) < 8) {
                DRM_INFO("DMAR active, disabling use of stolen memory\n");
                return 0;
        }
@@ -427,7 +425,7 @@ int i915_gem_init_stolen(struct drm_device *dev)
        if (ggtt->stolen_size == 0)
                return 0;
 
-       dev_priv->mm.stolen_base = i915_stolen_to_physical(dev);
+       dev_priv->mm.stolen_base = i915_stolen_to_physical(dev_priv);
        if (dev_priv->mm.stolen_base == 0)
                return 0;