Subject: add __iomem to ioremap

From: Atsushi Nemoto <[email-masked]>
Date: Mon, 26 Sep 2005 00:17:53 +0900 (JST)

Some function like iounmap, read[bwlq], etc. have been using __iomem
attribute, but ioremap does not use it.  Here is a patch to add
__iomem to ioremap family.  This would kill some sparse warnings.

diff -ur /home/cvs/linux-mips/include/asm-mips/io.h linux/include/asm-mips/io.h
--- linux-mips/include/asm-mips/io.h	2005-09-25 00:12:39.000000000 +0900
+++ linux/include/asm-mips/io.h	2005-09-25 23:08:18.930898136 +0900
@@ -203,10 +203,10 @@
  */
 #define page_to_phys(page)	((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
 
-extern void * __ioremap(phys_t offset, phys_t size, unsigned long flags);
+extern void __iomem * __ioremap(phys_t offset, phys_t size, unsigned long flags);
 extern void __iounmap(volatile void __iomem *addr);
 
-static inline void * __ioremap_mode(phys_t offset, unsigned long size,
+static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size,
 	unsigned long flags)
 {
 #define __IS_LOW512(addr) (!((phys_t)(addr) & (phys_t) ~0x1fffffffULL))
@@ -220,7 +220,7 @@
 		 */
 		if (flags == _CACHE_UNCACHED)
 			base = (u64) IO_BASE;
-		return (void *) (unsigned long) (base + offset);
+		return (void __iomem *) (unsigned long) (base + offset);
 	} else if (__builtin_constant_p(offset) &&
 		   __builtin_constant_p(size) && __builtin_constant_p(flags)) {
 		phys_t phys_addr, last_addr;
@@ -238,7 +238,7 @@
 		 */
 		if (__IS_LOW512(phys_addr) && __IS_LOW512(last_addr) &&
 		    flags == _CACHE_UNCACHED)
-			return (void *)CKSEG1ADDR(phys_addr);
+			return (void __iomem *)CKSEG1ADDR(phys_addr);
 
 	}
 
diff -ur linux-mips/arch/mips/mm/ioremap.c linux/arch/mips/mm/ioremap.c
--- linux-mips/arch/mips/mm/ioremap.c	2005-07-03 01:09:48.000000000 +0900
+++ linux/arch/mips/mm/ioremap.c	2005-09-25 23:09:24.944862488 +0900
@@ -117,7 +117,7 @@
 
 #define IS_LOW512(addr) (!((phys_t)(addr) & (phys_t) ~0x1fffffffULL))
 
-void * __ioremap(phys_t phys_addr, phys_t size, unsigned long flags)
+void __iomem * __ioremap(phys_t phys_addr, phys_t size, unsigned long flags)
 {
 	struct vm_struct * area;
 	unsigned long offset;
@@ -137,7 +137,7 @@
 	 */
 	if (IS_LOW512(phys_addr) && IS_LOW512(last_addr) &&
 	    flags == _CACHE_UNCACHED)
-		return (void *) CKSEG1ADDR(phys_addr);
+		return (void __iomem *) CKSEG1ADDR(phys_addr);
 
 	/*
 	 * Don't allow anybody to remap normal RAM that we're using..
@@ -173,7 +173,7 @@
 		return NULL;
 	}
 
-	return (void *) (offset + (char *)addr);
+	return (void __iomem *) (offset + (char *)addr);
 }
 
 #define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1)

---
Atsushi Nemoto

---

From: Ralf Baechle <[email-masked]>
Date: Fri, 30 Sep 2005 00:58:31 +0100

> __iomem to ioremap family.  This would kill some sparse warnings.

Thanks, applied.

  Ralf