drm/i915: Make i915_save/restore_state and intel_i2c_reset take dev_priv
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Thu, 1 Dec 2016 14:16:44 +0000 (14:16 +0000)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Thu, 1 Dec 2016 18:01:23 +0000 (18:01 +0000)
dev_priv is more appropriate since it is used much more in these.

v2: Commit message and keep the local pdev variable. (Joonas Lahtinen)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_suspend.c
drivers/gpu/drm/i915/intel_i2c.c

index 809315cad316a754ee1694a01b7a30d5515b19ba..bd8994d028134c70fdcafcb327d86c18ab7f6541 100644 (file)
@@ -1439,7 +1439,7 @@ static int i915_drm_suspend(struct drm_device *dev)
 
        i915_gem_suspend_gtt_mappings(dev_priv);
 
-       i915_save_state(dev);
+       i915_save_state(dev_priv);
 
        opregion_target_state = suspend_to_idle(dev_priv) ? PCI_D1 : PCI_D3cold;
        intel_opregion_notify_adapter(dev_priv, opregion_target_state);
@@ -1562,7 +1562,7 @@ static int i915_drm_resume(struct drm_device *dev)
 
        i915_gem_resume(dev_priv);
 
-       i915_restore_state(dev);
+       i915_restore_state(dev_priv);
        intel_pps_unlock_regs_wa(dev_priv);
        intel_opregion_setup(dev_priv);
 
index 2006ea033354f3b14bf78c959dfc634a1209db8e..90ef5a09b40d0e4962f3a318f3cf8edc48e488fd 100644 (file)
@@ -3470,8 +3470,8 @@ extern void i915_perf_register(struct drm_i915_private *dev_priv);
 extern void i915_perf_unregister(struct drm_i915_private *dev_priv);
 
 /* i915_suspend.c */
-extern int i915_save_state(struct drm_device *dev);
-extern int i915_restore_state(struct drm_device *dev);
+extern int i915_save_state(struct drm_i915_private *dev_priv);
+extern int i915_restore_state(struct drm_i915_private *dev_priv);
 
 /* i915_sysfs.c */
 void i915_setup_sysfs(struct drm_i915_private *dev_priv);
@@ -3491,7 +3491,7 @@ static inline bool intel_gmbus_is_forced_bit(struct i2c_adapter *adapter)
 {
        return container_of(adapter, struct intel_gmbus, adapter)->force_bit;
 }
-extern void intel_i2c_reset(struct drm_device *dev);
+extern void intel_i2c_reset(struct drm_i915_private *dev_priv);
 
 /* intel_bios.c */
 int intel_bios_init(struct drm_i915_private *dev_priv);
index b0e1e7ca75da0c0b58ff2cceacff35d781e136d6..5c86925a029438d795e07d4f72f7da56e2605b23 100644 (file)
@@ -56,13 +56,12 @@ static void i915_restore_display(struct drm_i915_private *dev_priv)
        i915_redisable_vga(dev_priv);
 }
 
-int i915_save_state(struct drm_device *dev)
+int i915_save_state(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
        struct pci_dev *pdev = dev_priv->drm.pdev;
        int i;
 
-       mutex_lock(&dev->struct_mutex);
+       mutex_lock(&dev_priv->drm.struct_mutex);
 
        i915_save_display(dev_priv);
 
@@ -97,18 +96,17 @@ int i915_save_state(struct drm_device *dev)
                        dev_priv->regfile.saveSWF3[i] = I915_READ(SWF3(i));
        }
 
-       mutex_unlock(&dev->struct_mutex);
+       mutex_unlock(&dev_priv->drm.struct_mutex);
 
        return 0;
 }
 
-int i915_restore_state(struct drm_device *dev)
+int i915_restore_state(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
        struct pci_dev *pdev = dev_priv->drm.pdev;
        int i;
 
-       mutex_lock(&dev->struct_mutex);
+       mutex_lock(&dev_priv->drm.struct_mutex);
 
        i915_gem_restore_fences(dev_priv);
 
@@ -145,9 +143,9 @@ int i915_restore_state(struct drm_device *dev)
                        I915_WRITE(SWF3(i), dev_priv->regfile.saveSWF3[i]);
        }
 
-       mutex_unlock(&dev->struct_mutex);
+       mutex_unlock(&dev_priv->drm.struct_mutex);
 
-       intel_i2c_reset(dev);
+       intel_i2c_reset(dev_priv);
 
        return 0;
 }
index 85faba415633ed5de49d1318f25e370006259ccf..62fe529516b1997719db93ce879535308a0eeedb 100644 (file)
@@ -111,10 +111,8 @@ to_intel_gmbus(struct i2c_adapter *i2c)
 }
 
 void
-intel_i2c_reset(struct drm_device *dev)
+intel_i2c_reset(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
-
        I915_WRITE(GMBUS0, 0);
        I915_WRITE(GMBUS4, 0);
 }
@@ -211,7 +209,7 @@ intel_gpio_pre_xfer(struct i2c_adapter *adapter)
                                               adapter);
        struct drm_i915_private *dev_priv = bus->dev_priv;
 
-       intel_i2c_reset(&dev_priv->drm);
+       intel_i2c_reset(dev_priv);
        intel_i2c_quirk_set(dev_priv, true);
        set_data(bus, 1);
        set_clock(bus, 1);
@@ -677,7 +675,7 @@ int intel_setup_gmbus(struct drm_i915_private *dev_priv)
                        goto err;
        }
 
-       intel_i2c_reset(&dev_priv->drm);
+       intel_i2c_reset(dev_priv);
 
        return 0;