]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARM: provide runtime hook for ioremap/iounmap
authorRob Herring <rob.herring@calxeda.com>
Fri, 10 Feb 2012 23:05:13 +0000 (17:05 -0600)
committerRob Herring <rob.herring@calxeda.com>
Wed, 7 Mar 2012 03:22:01 +0000 (21:22 -0600)
We have compile time over-ride of ioremap and iounmap, but an run-time
override is needed for multi-platform builds. This adds an extra function
pointer check, but ioremap is not peformance critical. The option for
compile time selection remains.

The caller variant is used here to provide correct caller information as
ARM can only support level 0 for __builtin_return_address.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Russell King <linux@arm.linux.org.uk>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nicolas Pitre <nico@linaro.org>
arch/arm/include/asm/io.h
arch/arm/mm/ioremap.c

index 9275828feb3df24f481934a080572f8d53be3136..6c363c16851c71aa1434b4ae8f88f70e07fa2f48 100644 (file)
@@ -83,6 +83,11 @@ extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, uns
 extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
 extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, bool cached);
 extern void __iounmap(volatile void __iomem *addr);
+extern void __arm_iounmap(volatile void __iomem *addr);
+
+extern void __iomem * (*arch_ioremap_caller)(unsigned long, size_t,
+       unsigned int, void *);
+extern void (*arch_iounmap)(volatile void __iomem *);
 
 /*
  * Bad read/write accesses...
@@ -266,7 +271,7 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
  */
 #ifndef __arch_ioremap
 #define __arch_ioremap                 __arm_ioremap
-#define __arch_iounmap                 __iounmap
+#define __arch_iounmap                 __arm_iounmap
 #endif
 
 #define ioremap(cookie,size)           __arch_ioremap((cookie), (size), MT_DEVICE)
index 80632e8d7538f33d5a6539df5a72a90fff52e7ec..024629046f1f00eb9e01a8e6bced4fd92abb84f7 100644 (file)
@@ -306,11 +306,15 @@ __arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size,
 }
 EXPORT_SYMBOL(__arm_ioremap_pfn);
 
+void __iomem * (*arch_ioremap_caller)(unsigned long, size_t,
+                                     unsigned int, void *) =
+       __arm_ioremap_caller;
+
 void __iomem *
 __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
 {
-       return __arm_ioremap_caller(phys_addr, size, mtype,
-                       __builtin_return_address(0));
+       return arch_ioremap_caller(phys_addr, size, mtype,
+               __builtin_return_address(0));
 }
 EXPORT_SYMBOL(__arm_ioremap);
 
@@ -369,4 +373,11 @@ void __iounmap(volatile void __iomem *io_addr)
 
        vunmap(addr);
 }
-EXPORT_SYMBOL(__iounmap);
+
+void (*arch_iounmap)(volatile void __iomem *) = __iounmap;
+
+void __arm_iounmap(volatile void __iomem *io_addr)
+{
+       arch_iounmap(io_addr);
+}
+EXPORT_SYMBOL(__arm_iounmap);