blob: b3440c305b5d844cf58312e0654c3d515798d761 [file] [log] [blame]
Magnus Damm1e6760c2008-02-07 19:50:52 +09001#ifndef __ASM_SH_UACCESS_H
2#define __ASM_SH_UACCESS_H
3
Paul Mundt9b01bd92007-11-10 19:55:50 +09004#ifdef CONFIG_SUPERH32
5# include "uaccess_32.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -07006#else
Paul Mundt9b01bd92007-11-10 19:55:50 +09007# include "uaccess_64.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -07008#endif
Magnus Damm1e6760c2008-02-07 19:50:52 +09009
10static inline unsigned long
11copy_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
22static inline unsigned long
23copy_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 */