diff options
author | Jesper Nilsson <jespern@axis.com> | 2015-02-09 07:02:38 -0500 |
---|---|---|
committer | Jesper Nilsson <jespern@axis.com> | 2015-02-14 12:54:12 -0500 |
commit | 9987c19ed9a71693bf3efce2957666b2513a5252 (patch) | |
tree | d1bad49a469363dbec6dcb4b1e12ce6daad3156d /arch/cris | |
parent | 83f1588e9f770832b3446324110ff5b71e5f017c (diff) |
CRIS: Whitespace cleanup
No functional change, just clean up the most obvious.
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
Diffstat (limited to 'arch/cris')
-rw-r--r-- | arch/cris/include/asm/uaccess.h | 83 |
1 files changed, 52 insertions, 31 deletions
diff --git a/arch/cris/include/asm/uaccess.h b/arch/cris/include/asm/uaccess.h index a21344ab8616..e3530d0f13ee 100644 --- a/arch/cris/include/asm/uaccess.h +++ b/arch/cris/include/asm/uaccess.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Authors: Bjorn Wesen (bjornw@axis.com) | 2 | * Authors: Bjorn Wesen (bjornw@axis.com) |
3 | * Hans-Peter Nilsson (hp@axis.com) | 3 | * Hans-Peter Nilsson (hp@axis.com) |
4 | */ | 4 | */ |
@@ -35,7 +35,7 @@ | |||
35 | #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) | 35 | #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) |
36 | 36 | ||
37 | /* addr_limit is the maximum accessible address for the task. we misuse | 37 | /* addr_limit is the maximum accessible address for the task. we misuse |
38 | * the KERNEL_DS and USER_DS values to both assign and compare the | 38 | * the KERNEL_DS and USER_DS values to both assign and compare the |
39 | * addr_limit values through the equally misnamed get/set_fs macros. | 39 | * addr_limit values through the equally misnamed get/set_fs macros. |
40 | * (see above) | 40 | * (see above) |
41 | */ | 41 | */ |
@@ -51,7 +51,7 @@ | |||
51 | 51 | ||
52 | #define __kernel_ok (segment_eq(get_fs(), KERNEL_DS)) | 52 | #define __kernel_ok (segment_eq(get_fs(), KERNEL_DS)) |
53 | #define __user_ok(addr, size) \ | 53 | #define __user_ok(addr, size) \ |
54 | (((size) <= TASK_SIZE)&&((addr) <= TASK_SIZE-(size))) | 54 | (((size) <= TASK_SIZE) && ((addr) <= TASK_SIZE-(size))) |
55 | #define __access_ok(addr, size) (__kernel_ok || __user_ok((addr), (size))) | 55 | #define __access_ok(addr, size) (__kernel_ok || __user_ok((addr), (size))) |
56 | #define access_ok(type, addr, size) __access_ok((unsigned long)(addr), (size)) | 56 | #define access_ok(type, addr, size) __access_ok((unsigned long)(addr), (size)) |
57 | 57 | ||
@@ -70,8 +70,7 @@ | |||
70 | * on our cache or tlb entries. | 70 | * on our cache or tlb entries. |
71 | */ | 71 | */ |
72 | 72 | ||
73 | struct exception_table_entry | 73 | struct exception_table_entry { |
74 | { | ||
75 | unsigned long insn, fixup; | 74 | unsigned long insn, fixup; |
76 | }; | 75 | }; |
77 | 76 | ||
@@ -94,14 +93,14 @@ struct exception_table_entry | |||
94 | * exception handling means that it's no longer "just"...) | 93 | * exception handling means that it's no longer "just"...) |
95 | */ | 94 | */ |
96 | #define get_user(x, ptr) \ | 95 | #define get_user(x, ptr) \ |
97 | __get_user_check((x), (ptr), sizeof(*(ptr))) | 96 | __get_user_check((x), (ptr), sizeof(*(ptr))) |
98 | #define put_user(x, ptr) \ | 97 | #define put_user(x, ptr) \ |
99 | __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) | 98 | __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) |
100 | 99 | ||
101 | #define __get_user(x, ptr) \ | 100 | #define __get_user(x, ptr) \ |
102 | __get_user_nocheck((x), (ptr), sizeof(*(ptr))) | 101 | __get_user_nocheck((x), (ptr), sizeof(*(ptr))) |
103 | #define __put_user(x, ptr) \ | 102 | #define __put_user(x, ptr) \ |
104 | __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) | 103 | __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) |
105 | 104 | ||
106 | extern long __put_user_bad(void); | 105 | extern long __put_user_bad(void); |
107 | 106 | ||
@@ -109,11 +108,20 @@ extern long __put_user_bad(void); | |||
109 | do { \ | 108 | do { \ |
110 | retval = 0; \ | 109 | retval = 0; \ |
111 | switch (size) { \ | 110 | switch (size) { \ |
112 | case 1: __put_user_asm(x, ptr, retval, "move.b"); break; \ | 111 | case 1: \ |
113 | case 2: __put_user_asm(x, ptr, retval, "move.w"); break; \ | 112 | __put_user_asm(x, ptr, retval, "move.b"); \ |
114 | case 4: __put_user_asm(x, ptr, retval, "move.d"); break; \ | 113 | break; \ |
115 | case 8: __put_user_asm_64(x, ptr, retval); break; \ | 114 | case 2: \ |
116 | default: __put_user_bad(); \ | 115 | __put_user_asm(x, ptr, retval, "move.w"); \ |
116 | break; \ | ||
117 | case 4: \ | ||
118 | __put_user_asm(x, ptr, retval, "move.d"); \ | ||
119 | break; \ | ||
120 | case 8: \ | ||
121 | __put_user_asm_64(x, ptr, retval); \ | ||
122 | break; \ | ||
123 | default: \ | ||
124 | __put_user_bad(); \ | ||
117 | } \ | 125 | } \ |
118 | } while (0) | 126 | } while (0) |
119 | 127 | ||
@@ -121,11 +129,20 @@ do { \ | |||
121 | do { \ | 129 | do { \ |
122 | retval = 0; \ | 130 | retval = 0; \ |
123 | switch (size) { \ | 131 | switch (size) { \ |
124 | case 1: __get_user_asm(x, ptr, retval, "move.b"); break; \ | 132 | case 1: \ |
125 | case 2: __get_user_asm(x, ptr, retval, "move.w"); break; \ | 133 | __get_user_asm(x, ptr, retval, "move.b"); \ |
126 | case 4: __get_user_asm(x, ptr, retval, "move.d"); break; \ | 134 | break; \ |
127 | case 8: __get_user_asm_64(x, ptr, retval); break; \ | 135 | case 2: \ |
128 | default: (x) = __get_user_bad(); \ | 136 | __get_user_asm(x, ptr, retval, "move.w"); \ |
137 | break; \ | ||
138 | case 4: \ | ||
139 | __get_user_asm(x, ptr, retval, "move.d"); \ | ||
140 | break; \ | ||
141 | case 8: \ | ||
142 | __get_user_asm_64(x, ptr, retval); \ | ||
143 | break; \ | ||
144 | default: \ | ||
145 | (x) = __get_user_bad(); \ | ||
129 | } \ | 146 | } \ |
130 | } while (0) | 147 | } while (0) |
131 | 148 | ||
@@ -211,6 +228,7 @@ static inline long | |||
211 | strncpy_from_user(char *dst, const char __user *src, long count) | 228 | strncpy_from_user(char *dst, const char __user *src, long count) |
212 | { | 229 | { |
213 | long res = -EFAULT; | 230 | long res = -EFAULT; |
231 | |||
214 | if (access_ok(VERIFY_READ, src, 1)) | 232 | if (access_ok(VERIFY_READ, src, 1)) |
215 | res = __do_strncpy_from_user(dst, src, count); | 233 | res = __do_strncpy_from_user(dst, src, count); |
216 | return res; | 234 | return res; |
@@ -224,6 +242,7 @@ static inline unsigned long | |||
224 | __constant_copy_from_user(void *to, const void __user *from, unsigned long n) | 242 | __constant_copy_from_user(void *to, const void __user *from, unsigned long n) |
225 | { | 243 | { |
226 | unsigned long ret = 0; | 244 | unsigned long ret = 0; |
245 | |||
227 | if (n == 0) | 246 | if (n == 0) |
228 | ; | 247 | ; |
229 | else if (n == 1) | 248 | else if (n == 1) |
@@ -274,6 +293,7 @@ static inline unsigned long | |||
274 | __constant_copy_to_user(void __user *to, const void *from, unsigned long n) | 293 | __constant_copy_to_user(void __user *to, const void *from, unsigned long n) |
275 | { | 294 | { |
276 | unsigned long ret = 0; | 295 | unsigned long ret = 0; |
296 | |||
277 | if (n == 0) | 297 | if (n == 0) |
278 | ; | 298 | ; |
279 | else if (n == 1) | 299 | else if (n == 1) |
@@ -324,6 +344,7 @@ static inline unsigned long | |||
324 | __constant_clear_user(void __user *to, unsigned long n) | 344 | __constant_clear_user(void __user *to, unsigned long n) |
325 | { | 345 | { |
326 | unsigned long ret = 0; | 346 | unsigned long ret = 0; |
347 | |||
327 | if (n == 0) | 348 | if (n == 0) |
328 | ; | 349 | ; |
329 | else if (n == 1) | 350 | else if (n == 1) |
@@ -351,20 +372,20 @@ __constant_clear_user(void __user *to, unsigned long n) | |||
351 | } | 372 | } |
352 | 373 | ||
353 | 374 | ||
354 | #define clear_user(to, n) \ | 375 | #define clear_user(to, n) \ |
355 | (__builtin_constant_p(n) ? \ | 376 | (__builtin_constant_p(n) ? \ |
356 | __constant_clear_user(to, n) : \ | 377 | __constant_clear_user(to, n) : \ |
357 | __generic_clear_user(to, n)) | 378 | __generic_clear_user(to, n)) |
358 | 379 | ||
359 | #define copy_from_user(to, from, n) \ | 380 | #define copy_from_user(to, from, n) \ |
360 | (__builtin_constant_p(n) ? \ | 381 | (__builtin_constant_p(n) ? \ |
361 | __constant_copy_from_user(to, from, n) : \ | 382 | __constant_copy_from_user(to, from, n) : \ |
362 | __generic_copy_from_user(to, from, n)) | 383 | __generic_copy_from_user(to, from, n)) |
363 | 384 | ||
364 | #define copy_to_user(to, from, n) \ | 385 | #define copy_to_user(to, from, n) \ |
365 | (__builtin_constant_p(n) ? \ | 386 | (__builtin_constant_p(n) ? \ |
366 | __constant_copy_to_user(to, from, n) : \ | 387 | __constant_copy_to_user(to, from, n) : \ |
367 | __generic_copy_to_user(to, from, n)) | 388 | __generic_copy_to_user(to, from, n)) |
368 | 389 | ||
369 | /* We let the __ versions of copy_from/to_user inline, because they're often | 390 | /* We let the __ versions of copy_from/to_user inline, because they're often |
370 | * used in fast paths and have only a small space overhead. | 391 | * used in fast paths and have only a small space overhead. |