]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - arch/h8300/include/asm/uaccess.h
ARC: uaccess: enable INLINE_COPY_{TO,FROM}_USER ...
[karo-tx-linux.git] / arch / h8300 / include / asm / uaccess.h
1 #ifndef _ASM_UACCESS_H
2 #define _ASM_UACCESS_H
3
4 #include <linux/string.h>
5
6 static inline __must_check long __copy_from_user(void *to,
7                 const void __user * from, unsigned long n)
8 {
9         if (__builtin_constant_p(n)) {
10                 switch(n) {
11                 case 1:
12                         *(u8 *)to = *(u8 __force *)from;
13                         return 0;
14                 case 2:
15                         *(u16 *)to = *(u16 __force *)from;
16                         return 0;
17                 case 4:
18                         *(u32 *)to = *(u32 __force *)from;
19                         return 0;
20                 }
21         }
22
23         memcpy(to, (const void __force *)from, n);
24         return 0;
25 }
26
27 static inline __must_check long __copy_to_user(void __user *to,
28                 const void *from, unsigned long n)
29 {
30         if (__builtin_constant_p(n)) {
31                 switch(n) {
32                 case 1:
33                         *(u8 __force *)to = *(u8 *)from;
34                         return 0;
35                 case 2:
36                         *(u16 __force *)to = *(u16 *)from;
37                         return 0;
38                 case 4:
39                         *(u32 __force *)to = *(u32 *)from;
40                         return 0;
41                 default:
42                         break;
43                 }
44         }
45
46         memcpy((void __force *)to, from, n);
47         return 0;
48 }
49
50 #include <asm-generic/uaccess.h>
51
52 #endif