x86: user put_user_x instead of all variants.
authorGlauber Costa <gcosta@redhat.com>
Tue, 24 Jun 2008 18:02:31 +0000 (15:02 -0300)
committerIngo Molnar <mingo@elte.hu>
Wed, 9 Jul 2008 07:14:07 +0000 (09:14 +0200)
Follow the pattern, and define a single put_user_x, instead
of defining macros for all available sizes. Exception is
put_user_8, since the "A" constraint does not give us enough
power to specify which register (a or d) to use in the 32-bit
common case.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/asm-x86/uaccess_32.h

index 0ecfe47ad60d9a144fedea797975baa13b7f7b54..f8abc12a77c26083d51bc82d4068f0c037e78892 100644 (file)
@@ -186,25 +186,14 @@ extern void __put_user_2(void);
 extern void __put_user_4(void);
 extern void __put_user_8(void);
 
-#define __put_user_1(x, ptr)                                   \
-       asm volatile("call __put_user_1" : "=a" (__ret_pu)      \
-                    : "0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx")
-
-#define __put_user_2(x, ptr)                                   \
-       asm volatile("call __put_user_2" : "=a" (__ret_pu)      \
-                    : "0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx")
-
-#define __put_user_4(x, ptr)                                   \
-       asm volatile("call __put_user_4" : "=a" (__ret_pu)      \
-                    : "0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx")
+#define __put_user_x(size, x, ptr)                             \
+       asm volatile("call __put_user_" #size : "=a" (__ret_pu) \
+                    :"0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx")
 
 #define __put_user_8(x, ptr)                                   \
        asm volatile("call __put_user_8" : "=a" (__ret_pu)      \
                     : "A" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx")
 
-#define __put_user_X(x, ptr)                                   \
-       asm volatile("call __put_user_X" : "=a" (__ret_pu)      \
-                    : "c" (ptr): "ebx")
 
 /**
  * put_user: - Write a simple value into user space.
@@ -232,19 +221,19 @@ extern void __put_user_8(void);
        __pu_val = x;                                           \
        switch (sizeof(*(ptr))) {                               \
        case 1:                                                 \
-               __put_user_1(__pu_val, ptr);                    \
+               __put_user_x(1, __pu_val, ptr);                 \
                break;                                          \
        case 2:                                                 \
-               __put_user_2(__pu_val, ptr);                    \
+               __put_user_x(2, __pu_val, ptr);                 \
                break;                                          \
        case 4:                                                 \
-               __put_user_4(__pu_val, ptr);                    \
+               __put_user_x(4, __pu_val, ptr);                 \
                break;                                          \
        case 8:                                                 \
                __put_user_8(__pu_val, ptr);                    \
                break;                                          \
        default:                                                \
-               __put_user_X(__pu_val, ptr);                    \
+               __put_user_x(X, __pu_val, ptr);                 \
                break;                                          \
        }                                                       \
        __ret_pu;                                               \