Commit 12ff05e7 authored by Tvrtko Ursulin's avatar Tvrtko Ursulin

drm/i915: Make i915_destroy_error_state take dev_priv

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: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
parent 40196446
......@@ -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;
......
......@@ -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);
......
......@@ -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)
{
}
......
......@@ -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);
......
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment