diff options
Diffstat (limited to 'include/asm-sh/uaccess.h')
-rw-r--r-- | include/asm-sh/uaccess.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h index ff24ce95b238..b3440c305b5d 100644 --- a/include/asm-sh/uaccess.h +++ b/include/asm-sh/uaccess.h | |||
@@ -1,5 +1,34 @@ | |||
1 | #ifndef __ASM_SH_UACCESS_H | ||
2 | #define __ASM_SH_UACCESS_H | ||
3 | |||
1 | #ifdef CONFIG_SUPERH32 | 4 | #ifdef CONFIG_SUPERH32 |
2 | # include "uaccess_32.h" | 5 | # include "uaccess_32.h" |
3 | #else | 6 | #else |
4 | # include "uaccess_64.h" | 7 | # include "uaccess_64.h" |
5 | #endif | 8 | #endif |
9 | |||
10 | static inline unsigned long | ||
11 | copy_from_user(void *to, const void __user *from, unsigned long n) | ||
12 | { | ||
13 | unsigned long __copy_from = (unsigned long) from; | ||
14 | __kernel_size_t __copy_size = (__kernel_size_t) n; | ||
15 | |||
16 | if (__copy_size && __access_ok(__copy_from, __copy_size)) | ||
17 | return __copy_user(to, from, __copy_size); | ||
18 | |||
19 | return __copy_size; | ||
20 | } | ||
21 | |||
22 | static inline unsigned long | ||
23 | copy_to_user(void __user *to, const void *from, unsigned long n) | ||
24 | { | ||
25 | unsigned long __copy_to = (unsigned long) to; | ||
26 | __kernel_size_t __copy_size = (__kernel_size_t) n; | ||
27 | |||
28 | if (__copy_size && __access_ok(__copy_to, __copy_size)) | ||
29 | return __copy_user(to, from, __copy_size); | ||
30 | |||
31 | return __copy_size; | ||
32 | } | ||
33 | |||
34 | #endif /* __ASM_SH_UACCESS_H */ | ||