Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] Fix some sparse warnings
@ 2005-10-02 16:16 Atsushi Nemoto
  2005-10-03 10:40 ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Atsushi Nemoto @ 2005-10-02 16:16 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf

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;							\
 									\

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix some sparse warnings
  2005-10-02 16:16 [PATCH] Fix some sparse warnings Atsushi Nemoto
@ 2005-10-03 10:40 ` Ralf Baechle
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2005-10-03 10:40 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips

On Mon, Oct 03, 2005 at 01:16:37AM +0900, Atsushi Nemoto wrote:

> 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>

Thanks, applied.

  Ralf

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] Fix some sparse warnings
@ 2008-04-25 16:34 Atsushi Nemoto
  2008-04-27 17:33 ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Atsushi Nemoto @ 2008-04-25 16:34 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf

Fix some sparse warnings introduced by "[MIPS] Add support for MIPS
CMP platform." patch.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
Patch against linux-queue tree.

 arch/mips/kernel/traps.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 070f787..8686133 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -196,12 +196,12 @@ EXPORT_SYMBOL(dump_stack);
 static void show_code(unsigned int __user *pc)
 {
 	long i;
-	unsigned short *pc16 = NULL;
+	unsigned short __user *pc16 = NULL;
 
 	printk("\nCode:");
 
-	if ((unsigned int)pc & 1)
-		pc16 = (unsigned short *)((unsigned int)pc & ~1);
+	if ((unsigned long)pc & 1)
+		pc16 = (unsigned short __user *)((unsigned long)pc & ~1);
 	for(i = -3 ; i < 6 ; i++) {
 		unsigned int insn;
 		if (pc16 ? __get_user(insn, pc16 + i) : __get_user(insn, pc + i)) {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix some sparse warnings
  2008-04-25 16:34 Atsushi Nemoto
@ 2008-04-27 17:33 ` Ralf Baechle
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2008-04-27 17:33 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips

On Sat, Apr 26, 2008 at 01:34:35AM +0900, Atsushi Nemoto wrote:

> Fix some sparse warnings introduced by "[MIPS] Add support for MIPS
> CMP platform." patch.

Also folded into the CMP patch.  Thanks!

  Ralf

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-27 17:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-02 16:16 [PATCH] Fix some sparse warnings Atsushi Nemoto
2005-10-03 10:40 ` Ralf Baechle
  -- strict thread matches above, loose matches on Subject: below --
2008-04-25 16:34 Atsushi Nemoto
2008-04-27 17:33 ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox