linux-mips
[Top] [All Lists]

[PATCH] Fix some sparse warnings

To: linux-mips@linux-mips.org
Subject: [PATCH] Fix some sparse warnings
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Mon, 03 Oct 2005 01:16:37 +0900 (JST)
Cc: ralf@linux-mips.org
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
Make memcpy_fromio etc. more sparse-friendly.
Remove duplicate __user annotation from __copy_to_user.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -25,6 +25,7 @@
 #include <asm/page.h>
 #include <asm/pgtable-bits.h>
 #include <asm/processor.h>
+#include <asm/string.h>
 
 #include <ioremap.h>
 #include <mangle-port.h>
@@ -521,9 +522,18 @@ BUILDSTRING(q, u64)
 /* Depends on MIPS II instruction set */
 #define mmiowb() asm volatile ("sync" ::: "memory")
 
-#define memset_io(a,b,c)       memset((void *)(a),(b),(c))
-#define memcpy_fromio(a,b,c)   memcpy((a),(void *)(b),(c))
-#define memcpy_toio(a,b,c)     memcpy((void *)(a),(b),(c))
+static inline void memset_io(volatile void __iomem *addr, unsigned char val, 
int count)
+{
+       memset((void __force *) addr, val, count);
+}
+static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, 
int count)
+{
+       memcpy(dst, (void __force *) src, count);
+}
+static inline void memcpy_toio(volatile void __iomem *dst, const void *src, 
int count)
+{
+       memcpy((void __force *) dst, src, count);
+}
 
 /*
  * ISA space is 'always mapped' on currently supported MIPS systems, no need
diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h
--- a/include/asm-mips/uaccess.h
+++ b/include/asm-mips/uaccess.h
@@ -417,7 +417,7 @@ extern size_t __copy_user(void *__to, co
  */
 #define __copy_to_user(to,from,n)                                      \
 ({                                                                     \
-       void __user __user *__cu_to;                                    \
+       void __user *__cu_to;                                           \
        const void *__cu_from;                                          \
        long __cu_len;                                                  \
                                                                        \

<Prev in Thread] Current Thread [Next in Thread>