aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2015-01-06 16:29:43 -0500
committerMichael S. Tsirkin <mst@redhat.com>2015-01-13 08:24:12 -0500
commit4b636ba27008ce11631c89b4e0918800204575e0 (patch)
treec76017636d7f3c51593aa7c297e9f391810ccdb4 /arch/sparc
parent33a3dcc2289368c2fc022c3b0b9bc388c8aa5930 (diff)
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>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/include/asm/uaccess_64.h100
1 files changed, 37 insertions, 63 deletions
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h
index 12d95947636b..a35194b7dba0 100644
--- a/arch/sparc/include/asm/uaccess_64.h
+++ b/arch/sparc/include/asm/uaccess_64.h
@@ -106,26 +106,16 @@ void __retl_efault(void);
106struct __large_struct { unsigned long buf[100]; }; 106struct __large_struct { unsigned long buf[100]; };
107#define __m(x) ((struct __large_struct *)(x)) 107#define __m(x) ((struct __large_struct *)(x))
108 108
109#define __put_user_nocheck(data, addr, size) ({ \ 109#define __put_user_nocheck(data, addr, size) ({ \
110 register int __pu_ret; \ 110 register int __pu_ret; \
111 switch (size) { \ 111 switch (size) { \
112 case 1: \ 112 case 1: __put_user_asm(data, b, addr, __pu_ret); break; \
113 __put_user_asm(data, b, addr, __pu_ret); \ 113 case 2: __put_user_asm(data, h, addr, __pu_ret); break; \
114 break; \ 114 case 4: __put_user_asm(data, w, addr, __pu_ret); break; \
115 case 2: \ 115 case 8: __put_user_asm(data, x, addr, __pu_ret); break; \
116 __put_user_asm(data, h, addr, __pu_ret); \ 116 default: __pu_ret = __put_user_bad(); break; \
117 break; \ 117 } \
118 case 4: \ 118 __pu_ret; \
119 __put_user_asm(data, w, addr, __pu_ret); \
120 break; \
121 case 8: \
122 __put_user_asm(data, x, addr, __pu_ret); \
123 break; \
124 default: \
125 __pu_ret = __put_user_bad(); \
126 break; \
127 } \
128 __pu_ret; \
129}) 119})
130 120
131#define __put_user_asm(x, size, addr, ret) \ 121#define __put_user_asm(x, size, addr, ret) \
@@ -150,51 +140,35 @@ __asm__ __volatile__( \
150 140
151int __put_user_bad(void); 141int __put_user_bad(void);
152 142
153#define __get_user_nocheck(data, addr, size, type) ({ \ 143#define __get_user_nocheck(data, addr, size, type) ({ \
154 register int __gu_ret; \ 144 register int __gu_ret; \
155 register unsigned long __gu_val; \ 145 register unsigned long __gu_val; \
156 switch (size) { \ 146 switch (size) { \
157 case 1: \ 147 case 1: __get_user_asm(__gu_val, ub, addr, __gu_ret); break; \
158 __get_user_asm(__gu_val, ub, addr, __gu_ret); \ 148 case 2: __get_user_asm(__gu_val, uh, addr, __gu_ret); break; \
159 break; \ 149 case 4: __get_user_asm(__gu_val, uw, addr, __gu_ret); break; \
160 case 2: \ 150 case 8: __get_user_asm(__gu_val, x, addr, __gu_ret); break; \
161 __get_user_asm(__gu_val, uh, addr, __gu_ret); \ 151 default: \
162 break; \ 152 __gu_val = 0; \
163 case 4: \ 153 __gu_ret = __get_user_bad(); \
164 __get_user_asm(__gu_val, uw, addr, __gu_ret); \ 154 break; \
165 break; \ 155 } \
166 case 8: \ 156 data = (__force type) __gu_val; \
167 __get_user_asm(__gu_val, x, addr, __gu_ret); \ 157 __gu_ret; \
168 break; \
169 default: \
170 __gu_val = 0; \
171 __gu_ret = __get_user_bad(); \
172 break; \
173 } \
174 data = (__force type) __gu_val; \
175 __gu_ret; \
176}) 158})
177 159
178#define __get_user_nocheck_ret(data, addr, size, type, retval) ({ \ 160#define __get_user_nocheck_ret(data, addr, size, type, retval) ({ \
179 register unsigned long __gu_val __asm__ ("l1"); \ 161 register unsigned long __gu_val __asm__ ("l1"); \
180 switch (size) { \ 162 switch (size) { \
181 case 1: \ 163 case 1: __get_user_asm_ret(__gu_val, ub, addr, retval); break; \
182 __get_user_asm_ret(__gu_val, ub, addr, retval); \ 164 case 2: __get_user_asm_ret(__gu_val, uh, addr, retval); break; \
183 break; \ 165 case 4: __get_user_asm_ret(__gu_val, uw, addr, retval); break; \
184 case 2: \ 166 case 8: __get_user_asm_ret(__gu_val, x, addr, retval); break; \
185 __get_user_asm_ret(__gu_val, uh, addr, retval); \ 167 default: \
186 break; \ 168 if (__get_user_bad()) \
187 case 4: \ 169 return retval; \
188 __get_user_asm_ret(__gu_val, uw, addr, retval); \ 170 } \
189 break; \ 171 data = (__force type) __gu_val; \
190 case 8: \
191 __get_user_asm_ret(__gu_val, x, addr, retval); \
192 break; \
193 default: \
194 if (__get_user_bad()) \
195 return retval; \
196 } \
197 data = (__force type) __gu_val; \
198}) 172})
199 173
200#define __get_user_asm(x, size, addr, ret) \ 174#define __get_user_asm(x, size, addr, ret) \