Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

asm-generic/io.h: move ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef CONFIG_MMU

It allows some architectures to use this generic macro instead of
defining theirs.

sparc: io: To use the define of ioremap_[nocache|wc|wb] in asm-generic/io.h
It will move the ioremap_nocache out of the CONFIG_MMU ifdef. This means that
in order to suppress re-definition errors we need to remove the #define
in arch/sparc/include/asm/io_32.h. Also, the change adds a prototype for
ioremap where size is size_t and offset is phys_addr_t so fix that as well.

Signed-off-by: Greentime Hu <greentime@andestech.com>

+11 -16
-5
arch/sparc/include/asm/io_32.h
··· 127 127 * Bus number may be embedded in the higher bits of the physical address. 128 128 * This is why we have no bus number argument to ioremap(). 129 129 */ 130 - void __iomem *ioremap(unsigned long offset, unsigned long size); 131 - #define ioremap_nocache(X,Y) ioremap((X),(Y)) 132 - #define ioremap_wc(X,Y) ioremap((X),(Y)) 133 - #define ioremap_wt(X,Y) ioremap((X),(Y)) 134 130 void iounmap(volatile void __iomem *addr); 135 - 136 131 /* Create a virtual mapping cookie for an IO port range */ 137 132 void __iomem *ioport_map(unsigned long port, unsigned int nr); 138 133 void ioport_unmap(void __iomem *);
+2 -2
arch/sparc/kernel/ioport.c
··· 122 122 * 123 123 * Bus type is always zero on IIep. 124 124 */ 125 - void __iomem *ioremap(unsigned long offset, unsigned long size) 125 + void __iomem *ioremap(phys_addr_t offset, size_t size) 126 126 { 127 127 char name[14]; 128 128 129 129 sprintf(name, "phys_%08x", (u32)offset); 130 - return _sparc_alloc_io(0, offset, size, name); 130 + return _sparc_alloc_io(0, (unsigned long)offset, size, name); 131 131 } 132 132 EXPORT_SYMBOL(ioremap); 133 133
+9 -9
include/asm-generic/io.h
··· 852 852 } 853 853 #endif 854 854 855 + #ifndef iounmap 856 + #define iounmap iounmap 857 + 858 + static inline void iounmap(void __iomem *addr) 859 + { 860 + } 861 + #endif 862 + #endif /* CONFIG_MMU */ 855 863 #ifndef ioremap_nocache 864 + void __iomem *ioremap(phys_addr_t phys_addr, size_t size); 856 865 #define ioremap_nocache ioremap_nocache 857 866 static inline void __iomem *ioremap_nocache(phys_addr_t offset, size_t size) 858 867 { ··· 892 883 return ioremap_nocache(offset, size); 893 884 } 894 885 #endif 895 - 896 - #ifndef iounmap 897 - #define iounmap iounmap 898 - 899 - static inline void iounmap(void __iomem *addr) 900 - { 901 - } 902 - #endif 903 - #endif /* CONFIG_MMU */ 904 886 905 887 #ifdef CONFIG_HAS_IOPORT_MAP 906 888 #ifndef CONFIG_GENERIC_IOMAP