]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
asm-generic: add MMU variants of io.h functions
authorJonas Bonn <jonas@southpole.se>
Sat, 2 Jul 2011 15:17:35 +0000 (17:17 +0200)
committerJonas Bonn <jonas@southpole.se>
Fri, 22 Jul 2011 16:46:25 +0000 (18:46 +0200)
Some of the implementations, in particular the ioremap variants, in
asm-generic/io.h are for systems without an MMU.  In order to be able to
use the generic header file for systems with an MMU, this patch wraps
these implementations in checks for CONFIG_MMU.

Tested on OpenRISC.

Signed-off-by: Jonas Bonn <jonas@southpole.se>
Cc: liqin.chen@sunplusct.com
Cc: gxt@mprc.pku.edu.cn
Acked-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
include/asm-generic/io.h

index e0ffa3ddb02ad1e9e1fbb85e5e45e37102518597..a1caf2d25d82c465958ebd7f0d8219212560ce71 100644 (file)
@@ -307,7 +307,11 @@ static inline void *phys_to_virt(unsigned long address)
 
 /*
  * Change "struct page" to physical address.
+ *
+ * This implementation is for the no-MMU case only... if you have an MMU
+ * you'll need to provide your own definitions.
  */
+#ifndef CONFIG_MMU
 static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
 {
        return (void __iomem*) (unsigned long)offset;
@@ -326,6 +330,7 @@ static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
 static inline void iounmap(void *addr)
 {
 }
+#endif /* CONFIG_MMU */
 
 #ifndef CONFIG_GENERIC_IOMAP
 static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
@@ -342,7 +347,7 @@ extern void ioport_unmap(void __iomem *p);
 #endif /* CONFIG_GENERIC_IOMAP */
 
 #define xlate_dev_kmem_ptr(p)  p
-#define xlate_dev_mem_ptr(p)   ((void *) (p))
+#define xlate_dev_mem_ptr(p)   __va(p)
 
 #ifndef virt_to_bus
 static inline unsigned long virt_to_bus(volatile void *address)