forked from luck/tmp_suning_uos_patched
sparc64: nocheck uaccess coding style tweaks
Sam Ravnborg suggested packing single-lines cases in switch statements in nocheck uaccess macros makes for easier to read code. Suggested-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Sam Ravnborg <sam@ravnborg.org>
This commit is contained in:
parent
33a3dcc228
commit
4b636ba270
@ -106,26 +106,16 @@ void __retl_efault(void);
|
|||||||
struct __large_struct { unsigned long buf[100]; };
|
struct __large_struct { unsigned long buf[100]; };
|
||||||
#define __m(x) ((struct __large_struct *)(x))
|
#define __m(x) ((struct __large_struct *)(x))
|
||||||
|
|
||||||
#define __put_user_nocheck(data, addr, size) ({ \
|
#define __put_user_nocheck(data, addr, size) ({ \
|
||||||
register int __pu_ret; \
|
register int __pu_ret; \
|
||||||
switch (size) { \
|
switch (size) { \
|
||||||
case 1: \
|
case 1: __put_user_asm(data, b, addr, __pu_ret); break; \
|
||||||
__put_user_asm(data, b, addr, __pu_ret); \
|
case 2: __put_user_asm(data, h, addr, __pu_ret); break; \
|
||||||
break; \
|
case 4: __put_user_asm(data, w, addr, __pu_ret); break; \
|
||||||
case 2: \
|
case 8: __put_user_asm(data, x, addr, __pu_ret); break; \
|
||||||
__put_user_asm(data, h, addr, __pu_ret); \
|
default: __pu_ret = __put_user_bad(); break; \
|
||||||
break; \
|
} \
|
||||||
case 4: \
|
__pu_ret; \
|
||||||
__put_user_asm(data, w, addr, __pu_ret); \
|
|
||||||
break; \
|
|
||||||
case 8: \
|
|
||||||
__put_user_asm(data, x, addr, __pu_ret); \
|
|
||||||
break; \
|
|
||||||
default: \
|
|
||||||
__pu_ret = __put_user_bad(); \
|
|
||||||
break; \
|
|
||||||
} \
|
|
||||||
__pu_ret; \
|
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __put_user_asm(x, size, addr, ret) \
|
#define __put_user_asm(x, size, addr, ret) \
|
||||||
@ -150,51 +140,35 @@ __asm__ __volatile__( \
|
|||||||
|
|
||||||
int __put_user_bad(void);
|
int __put_user_bad(void);
|
||||||
|
|
||||||
#define __get_user_nocheck(data, addr, size, type) ({ \
|
#define __get_user_nocheck(data, addr, size, type) ({ \
|
||||||
register int __gu_ret; \
|
register int __gu_ret; \
|
||||||
register unsigned long __gu_val; \
|
register unsigned long __gu_val; \
|
||||||
switch (size) { \
|
switch (size) { \
|
||||||
case 1: \
|
case 1: __get_user_asm(__gu_val, ub, addr, __gu_ret); break; \
|
||||||
__get_user_asm(__gu_val, ub, addr, __gu_ret); \
|
case 2: __get_user_asm(__gu_val, uh, addr, __gu_ret); break; \
|
||||||
break; \
|
case 4: __get_user_asm(__gu_val, uw, addr, __gu_ret); break; \
|
||||||
case 2: \
|
case 8: __get_user_asm(__gu_val, x, addr, __gu_ret); break; \
|
||||||
__get_user_asm(__gu_val, uh, addr, __gu_ret); \
|
default: \
|
||||||
break; \
|
__gu_val = 0; \
|
||||||
case 4: \
|
__gu_ret = __get_user_bad(); \
|
||||||
__get_user_asm(__gu_val, uw, addr, __gu_ret); \
|
break; \
|
||||||
break; \
|
} \
|
||||||
case 8: \
|
data = (__force type) __gu_val; \
|
||||||
__get_user_asm(__gu_val, x, addr, __gu_ret); \
|
__gu_ret; \
|
||||||
break; \
|
|
||||||
default: \
|
|
||||||
__gu_val = 0; \
|
|
||||||
__gu_ret = __get_user_bad(); \
|
|
||||||
break; \
|
|
||||||
} \
|
|
||||||
data = (__force type) __gu_val; \
|
|
||||||
__gu_ret; \
|
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __get_user_nocheck_ret(data, addr, size, type, retval) ({ \
|
#define __get_user_nocheck_ret(data, addr, size, type, retval) ({ \
|
||||||
register unsigned long __gu_val __asm__ ("l1"); \
|
register unsigned long __gu_val __asm__ ("l1"); \
|
||||||
switch (size) { \
|
switch (size) { \
|
||||||
case 1: \
|
case 1: __get_user_asm_ret(__gu_val, ub, addr, retval); break; \
|
||||||
__get_user_asm_ret(__gu_val, ub, addr, retval); \
|
case 2: __get_user_asm_ret(__gu_val, uh, addr, retval); break; \
|
||||||
break; \
|
case 4: __get_user_asm_ret(__gu_val, uw, addr, retval); break; \
|
||||||
case 2: \
|
case 8: __get_user_asm_ret(__gu_val, x, addr, retval); break; \
|
||||||
__get_user_asm_ret(__gu_val, uh, addr, retval); \
|
default: \
|
||||||
break; \
|
if (__get_user_bad()) \
|
||||||
case 4: \
|
return retval; \
|
||||||
__get_user_asm_ret(__gu_val, uw, addr, retval); \
|
} \
|
||||||
break; \
|
data = (__force type) __gu_val; \
|
||||||
case 8: \
|
|
||||||
__get_user_asm_ret(__gu_val, x, addr, retval); \
|
|
||||||
break; \
|
|
||||||
default: \
|
|
||||||
if (__get_user_bad()) \
|
|
||||||
return retval; \
|
|
||||||
} \
|
|
||||||
data = (__force type) __gu_val; \
|
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __get_user_asm(x, size, addr, ret) \
|
#define __get_user_asm(x, size, addr, ret) \
|
||||||
|
Loading…
Reference in New Issue
Block a user