Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 13 Feb 2015 18:43:04 +0000 (10:43 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 13 Feb 2015 18:43:04 +0000 (10:43 -0800)
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

MAINTAINERS
arch/tile/include/asm/uaccess.h
arch/tile/include/uapi/asm/byteorder.h

index 482bfc55397d4a07f42102fd8c7d577e75fdee39..debe74cde67b280eb4eb063733639a2a03a1b1e9 100644 (file)
@@ -9726,7 +9726,7 @@ F:        net/tipc/
 
 TILE ARCHITECTURE
 M:     Chris Metcalf <cmetcalf@ezchip.com>
-W:     http://www.tilera.com/scm/
+W:     http://www.ezchip.com/scm/
 S:     Supported
 F:     arch/tile/
 F:     drivers/char/tile-srom.c
index b6cde3209b963d76ba35815d45b003ef929691f2..f41cb53cf645dcb59287550aff82833e526c2e2c 100644 (file)
@@ -113,15 +113,15 @@ struct exception_table_entry {
 
 extern int fixup_exception(struct pt_regs *regs);
 
+/*
+ * This is a type: either unsigned long, if the argument fits into
+ * that type, or otherwise unsigned long long.
+ */
+#define __inttype(x) \
+       __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
+
 /*
  * Support macros for __get_user().
- *
- * Implementation note: The "case 8" logic of casting to the type of
- * the result of subtracting the value from itself is basically a way
- * of keeping all integer types the same, but casting any pointers to
- * ptrdiff_t, i.e. also an integer type.  This way there are no
- * questionable casts seen by the compiler on an ILP32 platform.
- *
  * Note that __get_user() and __put_user() assume proper alignment.
  */
 
@@ -178,7 +178,7 @@ extern int fixup_exception(struct pt_regs *regs);
                             "9:"                                       \
                             : "=r" (ret), "=r" (__a), "=&r" (__b)      \
                             : "r" (ptr), "i" (-EFAULT));               \
-               (x) = (__typeof(x))(__typeof((x)-(x)))                  \
+               (x) = (__force __typeof(x))(__inttype(x))               \
                        (((u64)__hi32(__a, __b) << 32) |                \
                         __lo32(__a, __b));                             \
        })
@@ -210,14 +210,16 @@ extern int __get_user_bad(void)
 #define __get_user(x, ptr)                                             \
        ({                                                              \
                int __ret;                                              \
+               typeof(x) _x;                                           \
                __chk_user_ptr(ptr);                                    \
                switch (sizeof(*(ptr))) {                               \
-               case 1: __get_user_1(x, ptr, __ret); break;             \
-               case 2: __get_user_2(x, ptr, __ret); break;             \
-               case 4: __get_user_4(x, ptr, __ret); break;             \
-               case 8: __get_user_8(x, ptr, __ret); break;             \
+               case 1: __get_user_1(_x, ptr, __ret); break;            \
+               case 2: __get_user_2(_x, ptr, __ret); break;            \
+               case 4: __get_user_4(_x, ptr, __ret); break;            \
+               case 8: __get_user_8(_x, ptr, __ret); break;            \
                default: __ret = __get_user_bad(); break;               \
                }                                                       \
+               (x) = (typeof(*(ptr))) _x;                              \
                __ret;                                                  \
        })
 
@@ -246,7 +248,7 @@ extern int __get_user_bad(void)
 #define __put_user_4(x, ptr, ret) __put_user_asm(sw, x, ptr, ret)
 #define __put_user_8(x, ptr, ret)                                      \
        ({                                                              \
-               u64 __x = (__typeof((x)-(x)))(x);                       \
+               u64 __x = (__force __inttype(x))(x);                    \
                int __lo = (int) __x, __hi = (int) (__x >> 32);         \
                asm volatile("1: { sw %1, %2; addi %0, %1, 4 }\n"       \
                             "2: { sw %0, %3; movei %0, 0 }\n"          \
@@ -289,12 +291,13 @@ extern int __put_user_bad(void)
 #define __put_user(x, ptr)                                             \
 ({                                                                     \
        int __ret;                                                      \
+       typeof(*(ptr)) _x = (x);                                        \
        __chk_user_ptr(ptr);                                            \
        switch (sizeof(*(ptr))) {                                       \
-       case 1: __put_user_1(x, ptr, __ret); break;                     \
-       case 2: __put_user_2(x, ptr, __ret); break;                     \
-       case 4: __put_user_4(x, ptr, __ret); break;                     \
-       case 8: __put_user_8(x, ptr, __ret); break;                     \
+       case 1: __put_user_1(_x, ptr, __ret); break;                    \
+       case 2: __put_user_2(_x, ptr, __ret); break;                    \
+       case 4: __put_user_4(_x, ptr, __ret); break;                    \
+       case 8: __put_user_8(_x, ptr, __ret); break;                    \
        default: __ret = __put_user_bad(); break;                       \
        }                                                               \
        __ret;                                                          \
index fb72ecf49218a4e6b9e5bd6fe93261e2565f61d2..6b8fa2e1cf6e11d5bf6331e290a234bb7ef55b85 100644 (file)
@@ -14,8 +14,6 @@
 
 #if defined (__BIG_ENDIAN__)
 #include <linux/byteorder/big_endian.h>
-#elif defined (__LITTLE_ENDIAN__)
-#include <linux/byteorder/little_endian.h>
 #else
-#error "__BIG_ENDIAN__ or __LITTLE_ENDIAN__ must be defined."
+#include <linux/byteorder/little_endian.h>
 #endif