aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-01-05 11:41:48 -0500
committerChris Wilson <chris@chris-wilson.co.uk>2017-01-05 16:02:04 -0500
commitb7163936bd99dab90a71c2496295f62f2b4874ab (patch)
tree505dfdbe70d0f3b2bb2fbd8dfbdda6e35a4174d6
parent121dfbb2a2ef1c5f49e15c38ccc47ff0beb59446 (diff)
drm/i915: Move a few more utility macros to i915_utils.h
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@chris-wilson.co.uk> Link: http://patchwork.freedesktop.org/patch/msgid/20170105164148.26875-1-chris@chris-wilson.co.uk Reviewed-by: Matthew Auld <matthew.auld@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h20
-rw-r--r--drivers/gpu/drm/i915/i915_utils.h20
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 abc8d737cd68..239a120a0ec1 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -4026,24 +4026,4 @@ int remap_io_mapping(struct vm_area_struct *vma,
4026 unsigned long addr, unsigned long pfn, unsigned long size, 4026 unsigned long addr, unsigned long pfn, unsigned long size,
4027 struct io_mapping *iomap); 4027 struct io_mapping *iomap);
4028 4028
4029#define ptr_mask_bits(ptr) ({ \
4030 unsigned long __v = (unsigned long)(ptr); \
4031 (typeof(ptr))(__v & PAGE_MASK); \
4032})
4033
4034#define ptr_unpack_bits(ptr, bits) ({ \
4035 unsigned long __v = (unsigned long)(ptr); \
4036 (bits) = __v & ~PAGE_MASK; \
4037 (typeof(ptr))(__v & PAGE_MASK); \
4038})
4039
4040#define ptr_pack_bits(ptr, bits) \
4041 ((typeof(ptr))((unsigned long)(ptr) | (bits)))
4042
4043#define fetch_and_zero(ptr) ({ \
4044 typeof(*ptr) __T = *(ptr); \
4045 *(ptr) = (typeof(*ptr))0; \
4046 __T; \
4047})
4048
4049#endif 4029#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 @@
41#define overflows_type(x, T) \ 41#define overflows_type(x, T) \
42 (sizeof(x) > sizeof(T) && (x) >> (sizeof(T) * BITS_PER_BYTE)) 42 (sizeof(x) > sizeof(T) && (x) >> (sizeof(T) * BITS_PER_BYTE))
43 43
44#define ptr_mask_bits(ptr) ({ \
45 unsigned long __v = (unsigned long)(ptr); \
46 (typeof(ptr))(__v & PAGE_MASK); \
47})
48
49#define ptr_unpack_bits(ptr, bits) ({ \
50 unsigned long __v = (unsigned long)(ptr); \
51 (bits) = __v & ~PAGE_MASK; \
52 (typeof(ptr))(__v & PAGE_MASK); \
53})
54
55#define ptr_pack_bits(ptr, bits) \
56 ((typeof(ptr))((unsigned long)(ptr) | (bits)))
57
58#define fetch_and_zero(ptr) ({ \
59 typeof(*ptr) __T = *(ptr); \
60 *(ptr) = (typeof(*ptr))0; \
61 __T; \
62})
63
44#endif /* !__I915_UTILS_H */ 64#endif /* !__I915_UTILS_H */