asm-generic/uaccess.h: don't mess with __copy_{to,from}_user
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 28 Mar 2017 04:51:43 +0000 (00:51 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 28 Mar 2017 20:43:44 +0000 (16:43 -0400)
only h8300 actually used those; might as well define them there.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
arch/c6x/include/asm/uaccess.h
arch/h8300/include/asm/Kbuild
arch/h8300/include/asm/uaccess.h [new file with mode: 0644]
arch/um/include/asm/uaccess.h
arch/unicore32/include/asm/uaccess.h
include/asm-generic/uaccess.h

index 453dd263bee39ba283f5278d79aa12e83fcd67f3..79fb6f439c5c7c99dccd21ba63969361acf34882 100644 (file)
@@ -94,9 +94,6 @@ static inline __must_check long __copy_to_user(void __user *to,
        return 0;
 }
 
-#define __copy_to_user   __copy_to_user
-#define __copy_from_user __copy_from_user
-
 extern int _access_ok(unsigned long addr, unsigned long size);
 #ifdef CONFIG_ACCESS_CHECK
 #define __access_ok _access_ok
index f14e4e6ccbde7d85c006e62a7b0cd7bfd451165e..757cdeb24e6ea00cfd8544f5d250ca61887aa774 100644 (file)
@@ -69,7 +69,6 @@ generic-y += tlbflush.h
 generic-y += trace_clock.h
 generic-y += topology.h
 generic-y += types.h
-generic-y += uaccess.h
 generic-y += ucontext.h
 generic-y += unaligned.h
 generic-y += vga.h
diff --git a/arch/h8300/include/asm/uaccess.h b/arch/h8300/include/asm/uaccess.h
new file mode 100644 (file)
index 0000000..c156a41
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef _ASM_UACCESS_H
+#define _ASM_UACCESS_H
+
+#include <linux/string.h>
+
+static inline __must_check long __copy_from_user(void *to,
+               const void __user * from, unsigned long n)
+{
+       if (__builtin_constant_p(n)) {
+               switch(n) {
+               case 1:
+                       *(u8 *)to = *(u8 __force *)from;
+                       return 0;
+               case 2:
+                       *(u16 *)to = *(u16 __force *)from;
+                       return 0;
+               case 4:
+                       *(u32 *)to = *(u32 __force *)from;
+                       return 0;
+               }
+       }
+
+       memcpy(to, (const void __force *)from, n);
+       return 0;
+}
+
+static inline __must_check long __copy_to_user(void __user *to,
+               const void *from, unsigned long n)
+{
+       if (__builtin_constant_p(n)) {
+               switch(n) {
+               case 1:
+                       *(u8 __force *)to = *(u8 *)from;
+                       return 0;
+               case 2:
+                       *(u16 __force *)to = *(u16 *)from;
+                       return 0;
+               case 4:
+                       *(u32 __force *)to = *(u32 *)from;
+                       return 0;
+               default:
+                       break;
+               }
+       }
+
+       memcpy((void __force *)to, from, n);
+       return 0;
+}
+
+#include <asm-generic/uaccess.h>
+
+#endif
index e992bb57da5a7df21d80cb6bff4cbd94cd0432a1..9396c8a4e920aa5b32e13af907159886420f1206 100644 (file)
@@ -31,8 +31,6 @@ static inline int __access_ok(unsigned long addr, unsigned long size);
 /* Teach asm-generic/uaccess.h that we have C functions for these. */
 #define __access_ok __access_ok
 #define __clear_user __clear_user
-#define __copy_to_user __copy_to_user
-#define __copy_from_user __copy_from_user
 #define __strnlen_user __strnlen_user
 #define __strncpy_from_user __strncpy_from_user
 #define __copy_to_user_inatomic __copy_to_user
index 1196c88c2f9b93418f20d1d563962e1a50650e08..b2bcab69dfeefcec7a3a698c77277469aae1dec1 100644 (file)
@@ -14,8 +14,6 @@
 
 #include <asm/memory.h>
 
-#define __copy_from_user       __copy_from_user
-#define __copy_to_user         __copy_to_user
 #define __strncpy_from_user    __strncpy_from_user
 #define __strnlen_user         __strnlen_user
 #define __clear_user           __clear_user
index 4b4f4a7f22c641739aa53783ecf107ee2f3a29c5..b048246a606b3b4c6f77ea3f584707921f6c69a6 100644 (file)
@@ -47,69 +47,6 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
 }
 #endif
 
-/*
- * architectures with an MMU should override these two
- */
-#ifndef __copy_from_user
-static inline __must_check long __copy_from_user(void *to,
-               const void __user * from, unsigned long n)
-{
-       if (__builtin_constant_p(n)) {
-               switch(n) {
-               case 1:
-                       *(u8 *)to = *(u8 __force *)from;
-                       return 0;
-               case 2:
-                       *(u16 *)to = *(u16 __force *)from;
-                       return 0;
-               case 4:
-                       *(u32 *)to = *(u32 __force *)from;
-                       return 0;
-#ifdef CONFIG_64BIT
-               case 8:
-                       *(u64 *)to = *(u64 __force *)from;
-                       return 0;
-#endif
-               default:
-                       break;
-               }
-       }
-
-       memcpy(to, (const void __force *)from, n);
-       return 0;
-}
-#endif
-
-#ifndef __copy_to_user
-static inline __must_check long __copy_to_user(void __user *to,
-               const void *from, unsigned long n)
-{
-       if (__builtin_constant_p(n)) {
-               switch(n) {
-               case 1:
-                       *(u8 __force *)to = *(u8 *)from;
-                       return 0;
-               case 2:
-                       *(u16 __force *)to = *(u16 *)from;
-                       return 0;
-               case 4:
-                       *(u32 __force *)to = *(u32 *)from;
-                       return 0;
-#ifdef CONFIG_64BIT
-               case 8:
-                       *(u64 __force *)to = *(u64 *)from;
-                       return 0;
-#endif
-               default:
-                       break;
-               }
-       }
-
-       memcpy((void __force *)to, from, n);
-       return 0;
-}
-#endif
-
 /*
  * These are the main single-value transfer routines.  They automatically
  * use the right size if we just have the right pointer type.