aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa/include/asm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-18 13:02:24 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-18 13:02:24 -0500
commiteaa0eda56223815cd9dc1225f715ff673ae77198 (patch)
tree12ed5208dda2ecbf2a652d6c54f83c58f362707d /arch/xtensa/include/asm
parentcad3ab5883b35b044200820bf2e1fbabe742740a (diff)
parent643165c8bbc8617d8222cb50c89e34fe64d226cf (diff)
Merge tag 'asm-generic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
Pull asm-generic uaccess.h cleanup from Arnd Bergmann: "Like in 3.19, I once more have a multi-stage cleanup for one asm-generic header file, this time the work was done by Michael Tsirkin and cleans up the uaccess.h file in asm-generic, as well as all architectures for which the respective maintainers did not pick up his patches directly" * tag 'asm-generic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: (37 commits) sparc32: nocheck uaccess coding style tweaks sparc64: nocheck uaccess coding style tweaks xtensa: macro whitespace fixes sh: macro whitespace fixes parisc: macro whitespace fixes m68k: macro whitespace fixes m32r: macro whitespace fixes frv: macro whitespace fixes cris: macro whitespace fixes avr32: macro whitespace fixes arm64: macro whitespace fixes arm: macro whitespace fixes alpha: macro whitespace fixes blackfin: macro whitespace fixes sparc64: uaccess_64 macro whitespace fixes sparc32: uaccess_32 macro whitespace fixes avr32: whitespace fix sh: fix put_user sparse errors metag: fix put_user sparse errors ia64: fix put_user sparse errors ...
Diffstat (limited to 'arch/xtensa/include/asm')
-rw-r--r--arch/xtensa/include/asm/uaccess.h90
1 files changed, 45 insertions, 45 deletions
diff --git a/arch/xtensa/include/asm/uaccess.h b/arch/xtensa/include/asm/uaccess.h
index 876eb380aa26..147b26ed9c91 100644
--- a/arch/xtensa/include/asm/uaccess.h
+++ b/arch/xtensa/include/asm/uaccess.h
@@ -182,13 +182,13 @@
182#define get_fs() (current->thread.current_ds) 182#define get_fs() (current->thread.current_ds)
183#define set_fs(val) (current->thread.current_ds = (val)) 183#define set_fs(val) (current->thread.current_ds = (val))
184 184
185#define segment_eq(a,b) ((a).seg == (b).seg) 185#define segment_eq(a, b) ((a).seg == (b).seg)
186 186
187#define __kernel_ok (segment_eq(get_fs(), KERNEL_DS)) 187#define __kernel_ok (segment_eq(get_fs(), KERNEL_DS))
188#define __user_ok(addr,size) \ 188#define __user_ok(addr, size) \
189 (((size) <= TASK_SIZE)&&((addr) <= TASK_SIZE-(size))) 189 (((size) <= TASK_SIZE)&&((addr) <= TASK_SIZE-(size)))
190#define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size))) 190#define __access_ok(addr, size) (__kernel_ok || __user_ok((addr), (size)))
191#define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size)) 191#define access_ok(type, addr, size) __access_ok((unsigned long)(addr), (size))
192 192
193/* 193/*
194 * These are the main single-value transfer routines. They 194 * These are the main single-value transfer routines. They
@@ -204,8 +204,8 @@
204 * (a) re-use the arguments for side effects (sizeof is ok) 204 * (a) re-use the arguments for side effects (sizeof is ok)
205 * (b) require any knowledge of processes at this stage 205 * (b) require any knowledge of processes at this stage
206 */ 206 */
207#define put_user(x,ptr) __put_user_check((x),(ptr),sizeof(*(ptr))) 207#define put_user(x, ptr) __put_user_check((x), (ptr), sizeof(*(ptr)))
208#define get_user(x,ptr) __get_user_check((x),(ptr),sizeof(*(ptr))) 208#define get_user(x, ptr) __get_user_check((x), (ptr), sizeof(*(ptr)))
209 209
210/* 210/*
211 * The "__xxx" versions of the user access functions are versions that 211 * The "__xxx" versions of the user access functions are versions that
@@ -213,39 +213,39 @@
213 * with a separate "access_ok()" call (this is used when we do multiple 213 * with a separate "access_ok()" call (this is used when we do multiple
214 * accesses to the same area of user memory). 214 * accesses to the same area of user memory).
215 */ 215 */
216#define __put_user(x,ptr) __put_user_nocheck((x),(ptr),sizeof(*(ptr))) 216#define __put_user(x, ptr) __put_user_nocheck((x), (ptr), sizeof(*(ptr)))
217#define __get_user(x,ptr) __get_user_nocheck((x),(ptr),sizeof(*(ptr))) 217#define __get_user(x, ptr) __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
218 218
219 219
220extern long __put_user_bad(void); 220extern long __put_user_bad(void);
221 221
222#define __put_user_nocheck(x,ptr,size) \ 222#define __put_user_nocheck(x, ptr, size) \
223({ \ 223({ \
224 long __pu_err; \ 224 long __pu_err; \
225 __put_user_size((x),(ptr),(size),__pu_err); \ 225 __put_user_size((x), (ptr), (size), __pu_err); \
226 __pu_err; \ 226 __pu_err; \
227}) 227})
228 228
229#define __put_user_check(x,ptr,size) \ 229#define __put_user_check(x, ptr, size) \
230({ \ 230({ \
231 long __pu_err = -EFAULT; \ 231 long __pu_err = -EFAULT; \
232 __typeof__(*(ptr)) *__pu_addr = (ptr); \ 232 __typeof__(*(ptr)) *__pu_addr = (ptr); \
233 if (access_ok(VERIFY_WRITE,__pu_addr,size)) \ 233 if (access_ok(VERIFY_WRITE, __pu_addr, size)) \
234 __put_user_size((x),__pu_addr,(size),__pu_err); \ 234 __put_user_size((x), __pu_addr, (size), __pu_err); \
235 __pu_err; \ 235 __pu_err; \
236}) 236})
237 237
238#define __put_user_size(x,ptr,size,retval) \ 238#define __put_user_size(x, ptr, size, retval) \
239do { \ 239do { \
240 int __cb; \ 240 int __cb; \
241 retval = 0; \ 241 retval = 0; \
242 switch (size) { \ 242 switch (size) { \
243 case 1: __put_user_asm(x,ptr,retval,1,"s8i",__cb); break; \ 243 case 1: __put_user_asm(x, ptr, retval, 1, "s8i", __cb); break; \
244 case 2: __put_user_asm(x,ptr,retval,2,"s16i",__cb); break; \ 244 case 2: __put_user_asm(x, ptr, retval, 2, "s16i", __cb); break; \
245 case 4: __put_user_asm(x,ptr,retval,4,"s32i",__cb); break; \ 245 case 4: __put_user_asm(x, ptr, retval, 4, "s32i", __cb); break; \
246 case 8: { \ 246 case 8: { \
247 __typeof__(*ptr) __v64 = x; \ 247 __typeof__(*ptr) __v64 = x; \
248 retval = __copy_to_user(ptr,&__v64,8); \ 248 retval = __copy_to_user(ptr, &__v64, 8); \
249 break; \ 249 break; \
250 } \ 250 } \
251 default: __put_user_bad(); \ 251 default: __put_user_bad(); \
@@ -316,35 +316,35 @@ __asm__ __volatile__( \
316 :"=r" (err), "=r" (cb) \ 316 :"=r" (err), "=r" (cb) \
317 :"r" ((int)(x)), "r" (addr), "i" (-EFAULT), "0" (err)) 317 :"r" ((int)(x)), "r" (addr), "i" (-EFAULT), "0" (err))
318 318
319#define __get_user_nocheck(x,ptr,size) \ 319#define __get_user_nocheck(x, ptr, size) \
320({ \ 320({ \
321 long __gu_err, __gu_val; \ 321 long __gu_err, __gu_val; \
322 __get_user_size(__gu_val,(ptr),(size),__gu_err); \ 322 __get_user_size(__gu_val, (ptr), (size), __gu_err); \
323 (x) = (__force __typeof__(*(ptr)))__gu_val; \ 323 (x) = (__force __typeof__(*(ptr)))__gu_val; \
324 __gu_err; \ 324 __gu_err; \
325}) 325})
326 326
327#define __get_user_check(x,ptr,size) \ 327#define __get_user_check(x, ptr, size) \
328({ \ 328({ \
329 long __gu_err = -EFAULT, __gu_val = 0; \ 329 long __gu_err = -EFAULT, __gu_val = 0; \
330 const __typeof__(*(ptr)) *__gu_addr = (ptr); \ 330 const __typeof__(*(ptr)) *__gu_addr = (ptr); \
331 if (access_ok(VERIFY_READ,__gu_addr,size)) \ 331 if (access_ok(VERIFY_READ, __gu_addr, size)) \
332 __get_user_size(__gu_val,__gu_addr,(size),__gu_err); \ 332 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
333 (x) = (__force __typeof__(*(ptr)))__gu_val; \ 333 (x) = (__force __typeof__(*(ptr)))__gu_val; \
334 __gu_err; \ 334 __gu_err; \
335}) 335})
336 336
337extern long __get_user_bad(void); 337extern long __get_user_bad(void);
338 338
339#define __get_user_size(x,ptr,size,retval) \ 339#define __get_user_size(x, ptr, size, retval) \
340do { \ 340do { \
341 int __cb; \ 341 int __cb; \
342 retval = 0; \ 342 retval = 0; \
343 switch (size) { \ 343 switch (size) { \
344 case 1: __get_user_asm(x,ptr,retval,1,"l8ui",__cb); break; \ 344 case 1: __get_user_asm(x, ptr, retval, 1, "l8ui", __cb); break;\
345 case 2: __get_user_asm(x,ptr,retval,2,"l16ui",__cb); break; \ 345 case 2: __get_user_asm(x, ptr, retval, 2, "l16ui", __cb); break;\
346 case 4: __get_user_asm(x,ptr,retval,4,"l32i",__cb); break; \ 346 case 4: __get_user_asm(x, ptr, retval, 4, "l32i", __cb); break;\
347 case 8: retval = __copy_from_user(&x,ptr,8); break; \ 347 case 8: retval = __copy_from_user(&x, ptr, 8); break; \
348 default: (x) = __get_user_bad(); \ 348 default: (x) = __get_user_bad(); \
349 } \ 349 } \
350} while (0) 350} while (0)
@@ -390,19 +390,19 @@ __asm__ __volatile__( \
390 */ 390 */
391 391
392extern unsigned __xtensa_copy_user(void *to, const void *from, unsigned n); 392extern unsigned __xtensa_copy_user(void *to, const void *from, unsigned n);
393#define __copy_user(to,from,size) __xtensa_copy_user(to,from,size) 393#define __copy_user(to, from, size) __xtensa_copy_user(to, from, size)
394 394
395 395
396static inline unsigned long 396static inline unsigned long
397__generic_copy_from_user_nocheck(void *to, const void *from, unsigned long n) 397__generic_copy_from_user_nocheck(void *to, const void *from, unsigned long n)
398{ 398{
399 return __copy_user(to,from,n); 399 return __copy_user(to, from, n);
400} 400}
401 401
402static inline unsigned long 402static inline unsigned long
403__generic_copy_to_user_nocheck(void *to, const void *from, unsigned long n) 403__generic_copy_to_user_nocheck(void *to, const void *from, unsigned long n)
404{ 404{
405 return __copy_user(to,from,n); 405 return __copy_user(to, from, n);
406} 406}
407 407
408static inline unsigned long 408static inline unsigned long
@@ -410,7 +410,7 @@ __generic_copy_to_user(void *to, const void *from, unsigned long n)
410{ 410{
411 prefetch(from); 411 prefetch(from);
412 if (access_ok(VERIFY_WRITE, to, n)) 412 if (access_ok(VERIFY_WRITE, to, n))
413 return __copy_user(to,from,n); 413 return __copy_user(to, from, n);
414 return n; 414 return n;
415} 415}
416 416
@@ -419,18 +419,18 @@ __generic_copy_from_user(void *to, const void *from, unsigned long n)
419{ 419{
420 prefetchw(to); 420 prefetchw(to);
421 if (access_ok(VERIFY_READ, from, n)) 421 if (access_ok(VERIFY_READ, from, n))
422 return __copy_user(to,from,n); 422 return __copy_user(to, from, n);
423 else 423 else
424 memset(to, 0, n); 424 memset(to, 0, n);
425 return n; 425 return n;
426} 426}
427 427
428#define copy_to_user(to,from,n) __generic_copy_to_user((to),(from),(n)) 428#define copy_to_user(to, from, n) __generic_copy_to_user((to), (from), (n))
429#define copy_from_user(to,from,n) __generic_copy_from_user((to),(from),(n)) 429#define copy_from_user(to, from, n) __generic_copy_from_user((to), (from), (n))
430#define __copy_to_user(to,from,n) \ 430#define __copy_to_user(to, from, n) \
431 __generic_copy_to_user_nocheck((to),(from),(n)) 431 __generic_copy_to_user_nocheck((to), (from), (n))
432#define __copy_from_user(to,from,n) \ 432#define __copy_from_user(to, from, n) \
433 __generic_copy_from_user_nocheck((to),(from),(n)) 433 __generic_copy_from_user_nocheck((to), (from), (n))
434#define __copy_to_user_inatomic __copy_to_user 434#define __copy_to_user_inatomic __copy_to_user
435#define __copy_from_user_inatomic __copy_from_user 435#define __copy_from_user_inatomic __copy_from_user
436 436