diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2015-01-06 16:40:11 -0500 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2015-01-13 08:24:14 -0500 |
commit | 0795cb1b46e7938ed679ccd48f933e75272b30e3 (patch) | |
tree | eddfd808a2680b14da23b435f1f52cad366a65de /arch/sparc/include | |
parent | 4b636ba27008ce11631c89b4e0918800204575e0 (diff) |
sparc32: 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/include')
-rw-r--r-- | arch/sparc/include/asm/uaccess_32.h | 96 |
1 files changed, 35 insertions, 61 deletions
diff --git a/arch/sparc/include/asm/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h index f96656209a78..64ee103dc29d 100644 --- a/arch/sparc/include/asm/uaccess_32.h +++ b/arch/sparc/include/asm/uaccess_32.h | |||
@@ -142,24 +142,14 @@ struct __large_struct { unsigned long buf[100]; }; | |||
142 | __pu_ret; \ | 142 | __pu_ret; \ |
143 | }) | 143 | }) |
144 | 144 | ||
145 | #define __put_user_nocheck(x, addr, size) ({ \ | 145 | #define __put_user_nocheck(x, addr, size) ({ \ |
146 | register int __pu_ret; \ | 146 | register int __pu_ret; \ |
147 | switch (size) { \ | 147 | switch (size) { \ |
148 | case 1: \ | 148 | case 1: __put_user_asm(x, b, addr, __pu_ret); break; \ |
149 | __put_user_asm(x, b, addr, __pu_ret); \ | 149 | case 2: __put_user_asm(x, h, addr, __pu_ret); break; \ |
150 | break; \ | 150 | case 4: __put_user_asm(x, , addr, __pu_ret); break; \ |
151 | case 2: \ | 151 | case 8: __put_user_asm(x, d, addr, __pu_ret); break; \ |
152 | __put_user_asm(x, h, addr, __pu_ret); \ | 152 | default: __pu_ret = __put_user_bad(); break; \ |
153 | break; \ | ||
154 | case 4: \ | ||
155 | __put_user_asm(x, , addr, __pu_ret); \ | ||
156 | break; \ | ||
157 | case 8: \ | ||
158 | __put_user_asm(x, d, addr, __pu_ret); \ | ||
159 | break; \ | ||
160 | default: \ | ||
161 | __pu_ret = __put_user_bad(); \ | ||
162 | break; \ | ||
163 | } \ | 153 | } \ |
164 | __pu_ret; \ | 154 | __pu_ret; \ |
165 | }) | 155 | }) |
@@ -240,51 +230,35 @@ int __put_user_bad(void); | |||
240 | return retval; \ | 230 | return retval; \ |
241 | }) | 231 | }) |
242 | 232 | ||
243 | #define __get_user_nocheck(x, addr, size, type) ({ \ | 233 | #define __get_user_nocheck(x, addr, size, type) ({ \ |
244 | register int __gu_ret; \ | 234 | register int __gu_ret; \ |
245 | register unsigned long __gu_val; \ | 235 | register unsigned long __gu_val; \ |
246 | switch (size) { \ | 236 | switch (size) { \ |
247 | case 1: \ | 237 | case 1: __get_user_asm(__gu_val, ub, addr, __gu_ret); break; \ |
248 | __get_user_asm(__gu_val, ub, addr, __gu_ret); \ | 238 | case 2: __get_user_asm(__gu_val, uh, addr, __gu_ret); break; \ |
249 | break; \ | 239 | case 4: __get_user_asm(__gu_val, , addr, __gu_ret); break; \ |
250 | case 2: \ | 240 | case 8: __get_user_asm(__gu_val, d, addr, __gu_ret); break; \ |
251 | __get_user_asm(__gu_val, uh, addr, __gu_ret); \ | 241 | default: \ |
252 | break; \ | 242 | __gu_val = 0; \ |
253 | case 4: \ | 243 | __gu_ret = __get_user_bad(); \ |
254 | __get_user_asm(__gu_val, , addr, __gu_ret); \ | 244 | break; \ |
255 | break; \ | 245 | } \ |
256 | case 8: \ | 246 | x = (__force type) __gu_val; \ |
257 | __get_user_asm(__gu_val, d, addr, __gu_ret); \ | 247 | __gu_ret; \ |
258 | break; \ | ||
259 | default: \ | ||
260 | __gu_val = 0; \ | ||
261 | __gu_ret = __get_user_bad(); \ | ||
262 | break; \ | ||
263 | } \ | ||
264 | x = (__force type) __gu_val; \ | ||
265 | __gu_ret; \ | ||
266 | }) | 248 | }) |
267 | 249 | ||
268 | #define __get_user_nocheck_ret(x, addr, size, type, retval) ({ \ | 250 | #define __get_user_nocheck_ret(x, addr, size, type, retval) ({ \ |
269 | register unsigned long __gu_val __asm__ ("l1"); \ | 251 | register unsigned long __gu_val __asm__ ("l1"); \ |
270 | switch (size) { \ | 252 | switch (size) { \ |
271 | case 1: \ | 253 | case 1: __get_user_asm_ret(__gu_val, ub, addr, retval); break; \ |
272 | __get_user_asm_ret(__gu_val, ub, addr, retval); \ | 254 | case 2: __get_user_asm_ret(__gu_val, uh, addr, retval); break; \ |
273 | break; \ | 255 | case 4: __get_user_asm_ret(__gu_val, , addr, retval); break; \ |
274 | case 2: \ | 256 | case 8: __get_user_asm_ret(__gu_val, d, addr, retval); break; \ |
275 | __get_user_asm_ret(__gu_val, uh, addr, retval); \ | 257 | default: \ |
276 | break; \ | 258 | if (__get_user_bad()) \ |
277 | case 4: \ | 259 | return retval; \ |
278 | __get_user_asm_ret(__gu_val, , addr, retval); \ | 260 | } \ |
279 | break; \ | 261 | x = (__force type) __gu_val; \ |
280 | case 8: \ | ||
281 | __get_user_asm_ret(__gu_val, d, addr, retval); \ | ||
282 | break; \ | ||
283 | default: \ | ||
284 | if (__get_user_bad()) \ | ||
285 | return retval; \ | ||
286 | } \ | ||
287 | x = (__force type) __gu_val; \ | ||
288 | }) | 262 | }) |
289 | 263 | ||
290 | #define __get_user_asm(x, size, addr, ret) \ | 264 | #define __get_user_asm(x, size, addr, ret) \ |