[Intel-gfx] [PATCH 14/18] drm/i915/gem: Prefer drm_WARN* over WARN*

Jani Nikula jani.nikula at linux.intel.com
Tue Apr 21 08:30:11 UTC 2020


On Mon, 06 Apr 2020, Pankaj Bharadiya <pankaj.laxminarayan.bharadiya at intel.com> wrote:
> struct drm_device specific drm_WARN* macros include device information
> in the backtrace, so we know what device the warnings originate from.
>
> Prefer drm_WARN* over WARN* at places where struct drm_device pointer
> can be extracted.

I'd like to have Chris' ack on this.

BR,
Jani.


>
> Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya at intel.com>
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +-
>  drivers/gpu/drm/i915/gem/i915_gem_phys.c       | 3 ++-
>  drivers/gpu/drm/i915/gem/i915_gem_userptr.c    | 2 +-
>  3 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index 9d11bad74e9a..d910eb9b77ef 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> @@ -1440,7 +1440,7 @@ eb_relocate_entry(struct i915_execbuffer *eb,
>  			err = i915_vma_bind(target->vma,
>  					    target->vma->obj->cache_level,
>  					    PIN_GLOBAL, NULL);
> -			if (WARN_ONCE(err,
> +			if (drm_WARN_ONCE(&i915->drm, err,
>  				      "Unexpected failure to bind target VMA!"))
>  				return err;
>  		}
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_phys.c b/drivers/gpu/drm/i915/gem/i915_gem_phys.c
> index 7fe9831aa9ba..4c1c7232b024 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_phys.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_phys.c
> @@ -27,7 +27,8 @@ static int i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj)
>  	void *dst;
>  	int i;
>  
> -	if (WARN_ON(i915_gem_object_needs_bit17_swizzle(obj)))
> +	if (drm_WARN_ON(obj->base.dev,
> +			i915_gem_object_needs_bit17_swizzle(obj)))
>  		return -EINVAL;
>  
>  	/*
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c
> index 7ffd7afeb7a5..8b0708708671 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c
> @@ -235,7 +235,7 @@ i915_gem_userptr_init__mmu_notifier(struct drm_i915_gem_object *obj,
>  	if (flags & I915_USERPTR_UNSYNCHRONIZED)
>  		return capable(CAP_SYS_ADMIN) ? 0 : -EPERM;
>  
> -	if (WARN_ON(obj->userptr.mm == NULL))
> +	if (drm_WARN_ON(obj->base.dev, obj->userptr.mm == NULL))
>  		return -EINVAL;
>  
>  	mn = i915_mmu_notifier_find(obj->userptr.mm);

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the Intel-gfx mailing list