drm/i915: Make i915_destroy_error_state take dev_priv
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Thu, 1 Dec 2016 14:16:43 +0000 (14:16 +0000)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Thu, 1 Dec 2016 18:01:23 +0000 (18:01 +0000)
Since it does not need dev at all.

Also change the stored pointer in struct i915_error_state_file_priv
to i915.

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_debugfs.c
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gpu_error.c
drivers/gpu/drm/i915/i915_sysfs.c

index d179eae1b1f6e3315ad9f664d882326187adfacd..567980833d762cf9f0bae1f74e19496878ad086b 100644 (file)
@@ -946,7 +946,7 @@ i915_error_state_write(struct file *filp,
        struct i915_error_state_file_priv *error_priv = filp->private_data;
 
        DRM_DEBUG_DRIVER("Resetting error state\n");
-       i915_destroy_error_state(error_priv->dev);
+       i915_destroy_error_state(error_priv->i915);
 
        return cnt;
 }
@@ -960,7 +960,7 @@ static int i915_error_state_open(struct inode *inode, struct file *file)
        if (!error_priv)
                return -ENOMEM;
 
-       error_priv->dev = &dev_priv->drm;
+       error_priv->i915 = dev_priv;
 
        i915_error_state_get(&dev_priv->drm, error_priv);
 
@@ -988,8 +988,8 @@ static ssize_t i915_error_state_read(struct file *file, char __user *userbuf,
        ssize_t ret_count = 0;
        int ret;
 
-       ret = i915_error_state_buf_init(&error_str,
-                                       to_i915(error_priv->dev), count, *pos);
+       ret = i915_error_state_buf_init(&error_str, error_priv->i915,
+                                       count, *pos);
        if (ret)
                return ret;
 
index fee0b46a04bc478223e584b8f6db9dac8ab1f7af..809315cad316a754ee1694a01b7a30d5515b19ba 100644 (file)
@@ -1307,7 +1307,7 @@ void i915_driver_unload(struct drm_device *dev)
 
        /* Free error state after interrupts are fully disabled. */
        cancel_delayed_work_sync(&dev_priv->gpu_error.hangcheck_work);
-       i915_destroy_error_state(dev);
+       i915_destroy_error_state(dev_priv);
 
        /* Flush any outstanding unpin_work. */
        drain_workqueue(dev_priv->wq);
index 44aecad47b21d17d0c7f54c6f0e292ba33fe2a6e..2006ea033354f3b14bf78c959dfc634a1209db8e 100644 (file)
@@ -1459,7 +1459,7 @@ struct drm_i915_error_state_buf {
 };
 
 struct i915_error_state_file_priv {
-       struct drm_device *dev;
+       struct drm_i915_private *i915;
        struct drm_i915_error_state *error;
 };
 
@@ -3434,7 +3434,7 @@ void i915_capture_error_state(struct drm_i915_private *dev_priv,
 void i915_error_state_get(struct drm_device *dev,
                          struct i915_error_state_file_priv *error_priv);
 void i915_error_state_put(struct i915_error_state_file_priv *error_priv);
-void i915_destroy_error_state(struct drm_device *dev);
+void i915_destroy_error_state(struct drm_i915_private *dev_priv);
 
 #else
 
@@ -3444,7 +3444,7 @@ static inline void i915_capture_error_state(struct drm_i915_private *dev_priv,
 {
 }
 
-static inline void i915_destroy_error_state(struct drm_device *dev)
+static inline void i915_destroy_error_state(struct drm_i915_private *dev_priv)
 {
 }
 
index 82458ea60150ace76d03fc84e8a12612267af0c9..a14f7badc337ca6cb8d56fd277d55d5fae0e228c 100644 (file)
@@ -514,7 +514,7 @@ static void err_print_capabilities(struct drm_i915_error_state_buf *m,
 int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
                            const struct i915_error_state_file_priv *error_priv)
 {
-       struct drm_i915_private *dev_priv = to_i915(error_priv->dev);
+       struct drm_i915_private *dev_priv = error_priv->i915;
        struct pci_dev *pdev = dev_priv->drm.pdev;
        struct drm_i915_error_state *error = error_priv->error;
        struct drm_i915_error_object *obj;
@@ -1644,9 +1644,8 @@ void i915_error_state_put(struct i915_error_state_file_priv *error_priv)
                kref_put(&error_priv->error->ref, i915_error_state_free);
 }
 
-void i915_destroy_error_state(struct drm_device *dev)
+void i915_destroy_error_state(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
        struct drm_i915_error_state *error;
 
        spin_lock_irq(&dev_priv->gpu_error.lock);
index 47590ab08d7ea65e7cc94594853117f78e04946b..b99fd96683174237b68d0cdbbb67392c25c621fb 100644 (file)
@@ -535,7 +535,7 @@ static ssize_t error_state_read(struct file *filp, struct kobject *kobj,
        if (ret)
                return ret;
 
-       error_priv.dev = dev;
+       error_priv.i915 = dev_priv;
        i915_error_state_get(dev, &error_priv);
 
        ret = i915_error_state_to_str(&error_str, &error_priv);
@@ -560,7 +560,7 @@ static ssize_t error_state_write(struct file *file, struct kobject *kobj,
        struct drm_i915_private *dev_priv = kdev_minor_to_i915(kdev);
 
        DRM_DEBUG_DRIVER("Resetting error state\n");
-       i915_destroy_error_state(&dev_priv->drm);
+       i915_destroy_error_state(dev_priv);
 
        return count;
 }