On Thu, Oct 23, 2014 at 08:35:24PM +0300, Mika Kuoppala wrote:
> because it is handy to direct bug reporters to do things like:
> 'grep -i suspend /sys/kernel/debug/dri/0/i915_gpu_state'
> 
> Signed-off-by: Mika Kuoppala <mika.kuopp...@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c   | 42 
> +++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/i915_drv.h       |  4 ++++
>  drivers/gpu/drm/i915/i915_gpu_error.c | 22 ++++++++++++++----
>  3 files changed, 64 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
> b/drivers/gpu/drm/i915/i915_debugfs.c
> index e60d5c2..8d3266d 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -976,6 +976,47 @@ static const struct file_operations 
> i915_error_state_fops = {
>       .release = i915_error_state_release,
>  };
>  
> +static int i915_gpu_state_open(struct inode *inode, struct file *file)
> +{
> +     struct drm_device *dev = inode->i_private;
> +     struct i915_error_state_file_priv *gpu_priv;
> +
> +     gpu_priv = kzalloc(sizeof(*gpu_priv), GFP_KERNEL);
> +     if (!gpu_priv)
> +             return -ENOMEM;
> +
> +     gpu_priv->dev = dev;
> +
> +     gpu_priv->error = i915_capture_gpu_state(dev);
> +     if (gpu_priv->error == NULL) {
> +             kfree(gpu_priv);
> +             return -ENOMEM;
> +     }
> +
> +     file->private_data = gpu_priv;
> +
> +     return 0;
> +}
> +
> +static int i915_gpu_state_release(struct inode *inode, struct file *file)
> +{
> +     struct i915_error_state_file_priv *gpu_priv = file->private_data;
> +
> +     kref_put(&gpu_priv->error->ref, i915_gpu_state_free);

A little bit of syntactic sugar here, and you can have my reviewed-by.

static inline void i915_error_state_put(struct drm_i915_error_state *err)
{
        kref_put(&err->ref, __i915_error_state_free);
}

I do agree that i915_gpu_state is a better name than i915_error_state.
Another patch for a rainy day without intelskitchen.com?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to