[Intel-gfx] [PATCH] drm/i915: Move a few more utility macros to i915_utils.h

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Thu Jan 5 17:06:28 UTC 2017


On 05/01/2017 16:41, Chris Wilson wrote:
> Now that we have split out a header file for simple macros (that maybe
> we can promote into a core header), move a few macros across from
> i915_drv.h
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_drv.h   | 20 --------------------
>  drivers/gpu/drm/i915/i915_utils.h | 20 ++++++++++++++++++++
>  2 files changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index fb6d93450927..4fb91f5c4cf1 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -4085,24 +4085,4 @@ int remap_io_mapping(struct vm_area_struct *vma,
>  		     unsigned long addr, unsigned long pfn, unsigned long size,
>  		     struct io_mapping *iomap);
>
> -#define ptr_mask_bits(ptr) ({						\
> -	unsigned long __v = (unsigned long)(ptr);			\
> -	(typeof(ptr))(__v & PAGE_MASK);					\
> -})
> -
> -#define ptr_unpack_bits(ptr, bits) ({					\
> -	unsigned long __v = (unsigned long)(ptr);			\
> -	(bits) = __v & ~PAGE_MASK;					\
> -	(typeof(ptr))(__v & PAGE_MASK);					\
> -})
> -
> -#define ptr_pack_bits(ptr, bits)					\
> -	((typeof(ptr))((unsigned long)(ptr) | (bits)))
> -
> -#define fetch_and_zero(ptr) ({						\
> -	typeof(*ptr) __T = *(ptr);					\
> -	*(ptr) = (typeof(*ptr))0;					\
> -	__T;								\
> -})
> -
>  #endif
> diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
> index 9983ef30bac8..34020873e1f6 100644
> --- a/drivers/gpu/drm/i915/i915_utils.h
> +++ b/drivers/gpu/drm/i915/i915_utils.h
> @@ -41,4 +41,24 @@
>  #define overflows_type(x, T) \
>  	(sizeof(x) > sizeof(T) && (x) >> (sizeof(T) * BITS_PER_BYTE))
>
> +#define ptr_mask_bits(ptr) ({						\
> +	unsigned long __v = (unsigned long)(ptr);			\
> +	(typeof(ptr))(__v & PAGE_MASK);					\
> +})
> +
> +#define ptr_unpack_bits(ptr, bits) ({					\
> +	unsigned long __v = (unsigned long)(ptr);			\
> +	(bits) = __v & ~PAGE_MASK;					\
> +	(typeof(ptr))(__v & PAGE_MASK);					\
> +})
> +
> +#define ptr_pack_bits(ptr, bits)					\
> +	((typeof(ptr))((unsigned long)(ptr) | (bits)))
> +
> +#define fetch_and_zero(ptr) ({						\
> +	typeof(*ptr) __T = *(ptr);					\
> +	*(ptr) = (typeof(*ptr))0;					\
> +	__T;								\
> +})
> +
>  #endif /* !__I915_UTILS_H */
>

You had my r-b for this one as well.

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Regards,

Tvrtko


More information about the Intel-gfx mailing list