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 d179eae..5679808 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 fee0b46..809315c 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 44aecad..2006ea0 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 82458ea..a14f7ba 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 47590ab..b99fd96 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;
 }