Message ID | 20230216123419.461016-5-bhe@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mm: ioremap: Convert architectures to take GENERIC_IOREMAP way | expand |
On Thu, Feb 16, 2023, at 13:34, Baoquan He wrote: > Architectures can be converted to GENERIC_IOREMAP, to take standard > ioremap_xxx() and iounmap() way. But some ARCH-es could have specific > handling for ioremap_prot(), ioremap() and iounmap(), than standard > methods. > > In oder to convert these ARCH-es to take GENERIC_IOREMAP, allow these > architecutres to have their own ioremap_prot(), ioremap() and iounmap() > definitions. > > Signed-off-by: Baoquan He <bhe@redhat.com> > Cc: Arnd Bergmann <arnd@arndb.de> > Cc: Kefeng Wang <wangkefeng.wang@huawei.com> > Cc: linux-arch@vger.kernel.org Acked-by: Arnd Bergmann <arnd@arndb.de>
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index 5a9cf16ee0c2..29ee791164ac 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -1081,11 +1081,14 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size, void iounmap(volatile void __iomem *addr); void generic_iounmap(volatile void __iomem *addr); +#ifndef ioremap +#define ioremap ioremap static inline void __iomem *ioremap(phys_addr_t addr, size_t size) { /* _PAGE_IOREMAP needs to be supplied by the architecture */ return ioremap_prot(addr, size, _PAGE_IOREMAP); } +#endif #endif /* !CONFIG_MMU || CONFIG_GENERIC_IOREMAP */ #ifndef ioremap_wc diff --git a/mm/ioremap.c b/mm/ioremap.c index db6234b9db59..9f34a8f90b58 100644 --- a/mm/ioremap.c +++ b/mm/ioremap.c @@ -46,12 +46,14 @@ void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size, return (void __iomem *)(vaddr + offset); } +#ifndef ioremap_prot void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size, unsigned long prot) { return generic_ioremap_prot(phys_addr, size, __pgprot(prot)); } EXPORT_SYMBOL(ioremap_prot); +#endif void generic_iounmap(volatile void __iomem *addr) { @@ -64,8 +66,10 @@ void generic_iounmap(volatile void __iomem *addr) vunmap(vaddr); } +#ifndef iounmap void iounmap(volatile void __iomem *addr) { generic_iounmap(addr); } EXPORT_SYMBOL(iounmap); +#endif
Architectures can be converted to GENERIC_IOREMAP, to take standard ioremap_xxx() and iounmap() way. But some ARCH-es could have specific handling for ioremap_prot(), ioremap() and iounmap(), than standard methods. In oder to convert these ARCH-es to take GENERIC_IOREMAP, allow these architecutres to have their own ioremap_prot(), ioremap() and iounmap() definitions. Signed-off-by: Baoquan He <bhe@redhat.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> Cc: linux-arch@vger.kernel.org --- include/asm-generic/io.h | 3 +++ mm/ioremap.c | 4 ++++ 2 files changed, 7 insertions(+)