aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-13 13:43:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-13 13:43:04 -0500
commitf1252515d901ee2a184a9d49a7f29ae14da823eb (patch)
treedeb2cd0776ace4fdb9614eb7f161e89dd2d76ee5 /arch/tile/include
parent8329aa9fff3fca84009e6a444d8d160193643bac (diff)
parent740e1433f50e6d0f1c4705c1a963645072f5a74c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile
Pull arch/tile changes from Chris Metcalf: "Not much in this batch, just some minor cleanups" * git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile: tile: change MAINTAINERS website from tilera.com to ezchip.com tile: enable sparse checks for get/put_user tile: fix put_user sparse errors tile: default to little endian on older toolchains
Diffstat (limited to 'arch/tile/include')
-rw-r--r--arch/tile/include/asm/uaccess.h37
-rw-r--r--arch/tile/include/uapi/asm/byteorder.h4
2 files changed, 21 insertions, 20 deletions
diff --git a/arch/tile/include/asm/uaccess.h b/arch/tile/include/asm/uaccess.h
index b6cde3209b96..f41cb53cf645 100644
--- a/arch/tile/include/asm/uaccess.h
+++ b/arch/tile/include/asm/uaccess.h
@@ -114,14 +114,14 @@ struct exception_table_entry {
114extern int fixup_exception(struct pt_regs *regs); 114extern int fixup_exception(struct pt_regs *regs);
115 115
116/* 116/*
117 * This is a type: either unsigned long, if the argument fits into
118 * that type, or otherwise unsigned long long.
119 */
120#define __inttype(x) \
121 __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
122
123/*
117 * Support macros for __get_user(). 124 * Support macros for __get_user().
118 *
119 * Implementation note: The "case 8" logic of casting to the type of
120 * the result of subtracting the value from itself is basically a way
121 * of keeping all integer types the same, but casting any pointers to
122 * ptrdiff_t, i.e. also an integer type. This way there are no
123 * questionable casts seen by the compiler on an ILP32 platform.
124 *
125 * Note that __get_user() and __put_user() assume proper alignment. 125 * Note that __get_user() and __put_user() assume proper alignment.
126 */ 126 */
127 127
@@ -178,7 +178,7 @@ extern int fixup_exception(struct pt_regs *regs);
178 "9:" \ 178 "9:" \
179 : "=r" (ret), "=r" (__a), "=&r" (__b) \ 179 : "=r" (ret), "=r" (__a), "=&r" (__b) \
180 : "r" (ptr), "i" (-EFAULT)); \ 180 : "r" (ptr), "i" (-EFAULT)); \
181 (x) = (__typeof(x))(__typeof((x)-(x))) \ 181 (x) = (__force __typeof(x))(__inttype(x)) \
182 (((u64)__hi32(__a, __b) << 32) | \ 182 (((u64)__hi32(__a, __b) << 32) | \
183 __lo32(__a, __b)); \ 183 __lo32(__a, __b)); \
184 }) 184 })
@@ -210,14 +210,16 @@ extern int __get_user_bad(void)
210#define __get_user(x, ptr) \ 210#define __get_user(x, ptr) \
211 ({ \ 211 ({ \
212 int __ret; \ 212 int __ret; \
213 typeof(x) _x; \
213 __chk_user_ptr(ptr); \ 214 __chk_user_ptr(ptr); \
214 switch (sizeof(*(ptr))) { \ 215 switch (sizeof(*(ptr))) { \
215 case 1: __get_user_1(x, ptr, __ret); break; \ 216 case 1: __get_user_1(_x, ptr, __ret); break; \
216 case 2: __get_user_2(x, ptr, __ret); break; \ 217 case 2: __get_user_2(_x, ptr, __ret); break; \
217 case 4: __get_user_4(x, ptr, __ret); break; \ 218 case 4: __get_user_4(_x, ptr, __ret); break; \
218 case 8: __get_user_8(x, ptr, __ret); break; \ 219 case 8: __get_user_8(_x, ptr, __ret); break; \
219 default: __ret = __get_user_bad(); break; \ 220 default: __ret = __get_user_bad(); break; \
220 } \ 221 } \
222 (x) = (typeof(*(ptr))) _x; \
221 __ret; \ 223 __ret; \
222 }) 224 })
223 225
@@ -246,7 +248,7 @@ extern int __get_user_bad(void)
246#define __put_user_4(x, ptr, ret) __put_user_asm(sw, x, ptr, ret) 248#define __put_user_4(x, ptr, ret) __put_user_asm(sw, x, ptr, ret)
247#define __put_user_8(x, ptr, ret) \ 249#define __put_user_8(x, ptr, ret) \
248 ({ \ 250 ({ \
249 u64 __x = (__typeof((x)-(x)))(x); \ 251 u64 __x = (__force __inttype(x))(x); \
250 int __lo = (int) __x, __hi = (int) (__x >> 32); \ 252 int __lo = (int) __x, __hi = (int) (__x >> 32); \
251 asm volatile("1: { sw %1, %2; addi %0, %1, 4 }\n" \ 253 asm volatile("1: { sw %1, %2; addi %0, %1, 4 }\n" \
252 "2: { sw %0, %3; movei %0, 0 }\n" \ 254 "2: { sw %0, %3; movei %0, 0 }\n" \
@@ -289,12 +291,13 @@ extern int __put_user_bad(void)
289#define __put_user(x, ptr) \ 291#define __put_user(x, ptr) \
290({ \ 292({ \
291 int __ret; \ 293 int __ret; \
294 typeof(*(ptr)) _x = (x); \
292 __chk_user_ptr(ptr); \ 295 __chk_user_ptr(ptr); \
293 switch (sizeof(*(ptr))) { \ 296 switch (sizeof(*(ptr))) { \
294 case 1: __put_user_1(x, ptr, __ret); break; \ 297 case 1: __put_user_1(_x, ptr, __ret); break; \
295 case 2: __put_user_2(x, ptr, __ret); break; \ 298 case 2: __put_user_2(_x, ptr, __ret); break; \
296 case 4: __put_user_4(x, ptr, __ret); break; \ 299 case 4: __put_user_4(_x, ptr, __ret); break; \
297 case 8: __put_user_8(x, ptr, __ret); break; \ 300 case 8: __put_user_8(_x, ptr, __ret); break; \
298 default: __ret = __put_user_bad(); break; \ 301 default: __ret = __put_user_bad(); break; \
299 } \ 302 } \
300 __ret; \ 303 __ret; \
diff --git a/arch/tile/include/uapi/asm/byteorder.h b/arch/tile/include/uapi/asm/byteorder.h
index fb72ecf49218..6b8fa2e1cf6e 100644
--- a/arch/tile/include/uapi/asm/byteorder.h
+++ b/arch/tile/include/uapi/asm/byteorder.h
@@ -14,8 +14,6 @@
14 14
15#if defined (__BIG_ENDIAN__) 15#if defined (__BIG_ENDIAN__)
16#include <linux/byteorder/big_endian.h> 16#include <linux/byteorder/big_endian.h>
17#elif defined (__LITTLE_ENDIAN__)
18#include <linux/byteorder/little_endian.h>
19#else 17#else
20#error "__BIG_ENDIAN__ or __LITTLE_ENDIAN__ must be defined." 18#include <linux/byteorder/little_endian.h>
21#endif 19#endif