[Intel-gfx] [PATCH 2/5] drm/i915: use kobj_to_dev()

Daniel Vetter daniel at ffwll.ch
Wed Jan 13 07:42:24 PST 2016


On Wed, Jan 13, 2016 at 10:48:40PM +0800, Geliang Tang wrote:
> Use kobj_to_dev() instead of open-coding it.
> 
> Signed-off-by: Geliang Tang <geliangtang at 163.com>

Queued for -next, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_sysfs.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
> index 37e3f0d..c6188dd 100644
> --- a/drivers/gpu/drm/i915/i915_sysfs.c
> +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> @@ -164,7 +164,7 @@ i915_l3_read(struct file *filp, struct kobject *kobj,
>  	     struct bin_attribute *attr, char *buf,
>  	     loff_t offset, size_t count)
>  {
> -	struct device *dev = container_of(kobj, struct device, kobj);
> +	struct device *dev = kobj_to_dev(kobj);
>  	struct drm_minor *dminor = dev_to_drm_minor(dev);
>  	struct drm_device *drm_dev = dminor->dev;
>  	struct drm_i915_private *dev_priv = drm_dev->dev_private;
> @@ -200,7 +200,7 @@ i915_l3_write(struct file *filp, struct kobject *kobj,
>  	      struct bin_attribute *attr, char *buf,
>  	      loff_t offset, size_t count)
>  {
> -	struct device *dev = container_of(kobj, struct device, kobj);
> +	struct device *dev = kobj_to_dev(kobj);
>  	struct drm_minor *dminor = dev_to_drm_minor(dev);
>  	struct drm_device *drm_dev = dminor->dev;
>  	struct drm_i915_private *dev_priv = drm_dev->dev_private;
> @@ -521,7 +521,7 @@ static ssize_t error_state_read(struct file *filp, struct kobject *kobj,
>  				loff_t off, size_t count)
>  {
>  
> -	struct device *kdev = container_of(kobj, struct device, kobj);
> +	struct device *kdev = kobj_to_dev(kobj);
>  	struct drm_minor *minor = dev_to_drm_minor(kdev);
>  	struct drm_device *dev = minor->dev;
>  	struct i915_error_state_file_priv error_priv;
> @@ -556,7 +556,7 @@ static ssize_t error_state_write(struct file *file, struct kobject *kobj,
>  				 struct bin_attribute *attr, char *buf,
>  				 loff_t off, size_t count)
>  {
> -	struct device *kdev = container_of(kobj, struct device, kobj);
> +	struct device *kdev = kobj_to_dev(kobj);
>  	struct drm_minor *minor = dev_to_drm_minor(kdev);
>  	struct drm_device *dev = minor->dev;
>  	int ret;
> -- 
> 2.5.0
> 
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list