Skip to contentSkip to conversation

arm64: ioremap: change ioremap prototype and add ioremap_cache macro

PATCH In review yalin wang 2 participants 2 messages Aug 27, 2015 – Sep 4, 2015 arm64

lore
Share & tools
lore

yalin wang

author
#0 lore raw

PATCH 1/1 arm64: ioremap: change ioremap prototype and add ioremap_cache macro

This patch change ioremap_*() first parameter type to resource_size_t to be the same as other platforms, and add ioremap_cache macro, because some code will test if this macro is defined or not, and will generate a generric version if not defined, for example, memremap.c do like this.

---
 arch/arm64/include/asm/io.h | 5 +++--
 arch/arm64/mm/ioremap.c     | 6 +++---
 2 files changed, 6 insertions(+), 5 deletions(-)
arch/arm64/include/asm/io.h +3 -2
index 44be1e0..500e09f 100644
@@ -163,15 +163,16 @@ extern void __memset_io(volatile void __iomem *, int, size_t);
 /*
  * I/O memory mapping functions.
  */
-extern void __iomem *__ioremap(phys_addr_t phys_addr, size_t size, pgprot_t prot);
+extern void __iomem *__ioremap(resource_size_t phys_addr, size_t size, pgprot_t prot);
 extern void __iounmap(volatile void __iomem *addr);
-extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size);
+extern void __iomem *ioremap_cache(resource_size_t phys_addr, size_t size);
 
 #define ioremap(addr, size)		__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
 #define ioremap_nocache(addr, size)	__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
 #define ioremap_wc(addr, size)		__ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
 #define ioremap_wt(addr, size)		__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
 #define iounmap				__iounmap
+#define ioremap_cache			ioremap_cache
 
 /*
  * io{read,write}{16,32}be() macros
arch/arm64/mm/ioremap.c +3 -3
index 01e88c8..082e963 100644
@@ -29,7 +29,7 @@
 #include <asm/tlbflush.h>
 #include <asm/pgalloc.h>
 
-static void __iomem *__ioremap_caller(phys_addr_t phys_addr, size_t size,
+static void __iomem *__ioremap_caller(resource_size_t phys_addr, size_t size,
 				      pgprot_t prot, void *caller)
 {
 	unsigned long last_addr;
@@ -73,7 +73,7 @@ static void __iomem *__ioremap_caller(phys_addr_t phys_addr, size_t size,
 	return (void __iomem *)(offset + addr);
 }
 
-void __iomem *__ioremap(phys_addr_t phys_addr, size_t size, pgprot_t prot)
+void __iomem *__ioremap(resource_size_t phys_addr, size_t size, pgprot_t prot)
 {
 	return __ioremap_caller(phys_addr, size, prot,
 				__builtin_return_address(0));
@@ -93,7 +93,7 @@ void __iounmap(volatile void __iomem *io_addr)
 }
 EXPORT_SYMBOL(__iounmap);
 
-void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size)
+void __iomem *ioremap_cache(resource_size_t phys_addr, size_t size)
 {
 	/* For normal memory we already have a cacheable mapping. */
 	if (pfn_valid(__phys_to_pfn(phys_addr)))
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 5 lines · yalin wang

This patch change ioremap_*() first parameter type to resource_size_t to be the same as other platforms, and add ioremap_cache macro, because some code will test if this macro is defined or not, and will generate a generric version if not defined, for example, memremap.c do like this.

It seems that asm-generic/io.h uses phys_addr_t (which makes more sense to me, though they are practically the same).

Quoted 1 line

+#define ioremap_cache ioremap_cache

This makes sense.

Signature · 1 line
Catalin