@@ -67,64 +67,12 @@ bool i915_error_injected(void);
6767 drm_err(&(i915)->drm, fmt, ##__VA_ARGS__); \
6868})
6969
70- #define ptr_mask_bits (ptr , n ) ({ \
71- unsigned long __v = (unsigned long)(ptr); \
72- (typeof(ptr))(__v & -BIT(n)); \
73- })
74-
75- #define ptr_unmask_bits (ptr , n ) ((unsigned long)(ptr) & (BIT(n) - 1))
76-
77- #define ptr_unpack_bits (ptr , bits , n ) ({ \
78- unsigned long __v = (unsigned long)(ptr); \
79- *(bits) = __v & (BIT(n) - 1); \
80- (typeof(ptr))(__v & -BIT(n)); \
81- })
82-
83- #define ptr_pack_bits (ptr , bits , n ) ({ \
84- unsigned long __bits = (bits); \
85- GEM_BUG_ON(__bits & -BIT(n)); \
86- ((typeof(ptr))((unsigned long)(ptr) | __bits)); \
87- })
88-
89- #define ptr_dec (ptr ) ({ \
90- unsigned long __v = (unsigned long)(ptr); \
91- (typeof(ptr))(__v - 1); \
92- })
93-
94- #define ptr_inc (ptr ) ({ \
95- unsigned long __v = (unsigned long)(ptr); \
96- (typeof(ptr))(__v + 1); \
97- })
98-
99- #define page_mask_bits (ptr ) ptr_mask_bits(ptr, PAGE_SHIFT)
100- #define page_unmask_bits (ptr ) ptr_unmask_bits(ptr, PAGE_SHIFT)
101- #define page_pack_bits (ptr , bits ) ptr_pack_bits(ptr, bits, PAGE_SHIFT)
102- #define page_unpack_bits (ptr , bits ) ptr_unpack_bits(ptr, bits, PAGE_SHIFT)
103-
10470#define fetch_and_zero (ptr ) ({ \
10571 typeof(*ptr) __T = *(ptr); \
10672 *(ptr) = (typeof(*ptr))0; \
10773 __T; \
10874})
10975
110- static __always_inline ptrdiff_t ptrdiff (const void * a , const void * b )
111- {
112- return a - b ;
113- }
114-
115- /*
116- * container_of_user: Extract the superclass from a pointer to a member.
117- *
118- * Exactly like container_of() with the exception that it plays nicely
119- * with sparse for __user @ptr.
120- */
121- #define container_of_user (ptr , type , member ) ({ \
122- void __user *__mptr = (void __user *)(ptr); \
123- BUILD_BUG_ON_MSG(!__same_type(*(ptr), typeof_member(type, member)) && \
124- !__same_type(*(ptr), void), \
125- "pointer type mismatch in container_of()"); \
126- ((type __user *)(__mptr - offsetof(type, member))); })
127-
12876/*
12977 * check_user_mbz: Check that a user value exists and is zero
13078 *
@@ -143,11 +91,6 @@ static __always_inline ptrdiff_t ptrdiff(const void *a, const void *b)
14391 get_user(mbz__, (U)) ? -EFAULT : mbz__ ? -EINVAL : 0; \
14492})
14593
146- #define u64_to_ptr (T , x ) ({ \
147- typecheck(u64, x); \
148- (T *)(uintptr_t)(x); \
149- })
150-
15194#define __mask_next_bit (mask ) ({ \
15295 int __idx = ffs(mask) - 1; \
15396 mask &= ~BIT(__idx); \
0 commit comments