]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
asm-generic: uaccess: Allow arches to over-ride __{get,put}_user_fn()
authorVineet Gupta <vgupta@synopsys.com>
Fri, 18 Jan 2013 09:42:16 +0000 (15:12 +0530)
committerVineet Gupta <vgupta@synopsys.com>
Mon, 11 Feb 2013 14:30:32 +0000 (20:00 +0530)
As of now these default to calling the arch provided __copy_{to,from}_user()
routines which being general purpose (w.r.t buffer alignment and lengths)
would lead to alignment checks in generated code (for arches which don't
support unaligned load/stores).

Given that in this case we already know that data involved is "unit"
sized and aligned, using the vanilla copy backend is a bit wasteful.

This change thus allows arches to over-ride the aforementioned routines.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
include/asm-generic/uaccess.h

index 5f6ee6138f9a338d59d12b2b8bc1d37bf7547c4e..c184aa8ec8cd5c81f189ff9350e52e6e27e5b2a6 100644 (file)
@@ -169,12 +169,18 @@ static inline __must_check long __copy_to_user(void __user *to,
                -EFAULT;                                        \
 })
 
+#ifndef __put_user_fn
+
 static inline int __put_user_fn(size_t size, void __user *ptr, void *x)
 {
        size = __copy_to_user(ptr, x, size);
        return size ? -EFAULT : size;
 }
 
+#define __put_user_fn(sz, u, k)        __put_user_fn(sz, u, k)
+
+#endif
+
 extern int __put_user_bad(void) __attribute__((noreturn));
 
 #define __get_user(x, ptr)                                     \
@@ -225,12 +231,17 @@ extern int __put_user_bad(void) __attribute__((noreturn));
                -EFAULT;                                        \
 })
 
+#ifndef __get_user_fn
 static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
 {
        size = __copy_from_user(x, ptr, size);
        return size ? -EFAULT : size;
 }
 
+#define __get_user_fn(sz, u, k)        __get_user_fn(sz, u, k)
+
+#endif
+
 extern int __get_user_bad(void) __attribute__((noreturn));
 
 #ifndef __copy_from_user_inatomic