diff mbox series

[v5,4/4] mips: io: remove duplicated codes

Message ID 20230921110424.215592-5-bhe@redhat.com (mailing list archive)
State New
Headers show
Series arch/*/io.h: remove ioremap_uc in some architectures | expand

Commit Message

Baoquan He Sept. 21, 2023, 11:04 a.m. UTC
By adding <asm-generic/io.h> support, the duplicated phys_to_virt
can be removed to use the default version in <asm-gneneric/io.h>.

Meanwhile move isa_bus_to_virt() down below <asm-generic/io.h> including
to fix the compiling error of missing phys_to_virt definition.

Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Serge Semin <fancer.lancer@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: linux-mips@vger.kernel.org
---
 arch/mips/include/asm/io.h | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)

Comments

Arnd Bergmann Sept. 21, 2023, 12:24 p.m. UTC | #1
On Thu, Sep 21, 2023, at 07:04, Baoquan He wrote:
> By adding <asm-generic/io.h> support, the duplicated phys_to_virt
> can be removed to use the default version in <asm-gneneric/io.h>.
>
> Meanwhile move isa_bus_to_virt() down below <asm-generic/io.h> including
> to fix the compiling error of missing phys_to_virt definition.
>

Acked-by: Arnd Bergmann <arnd@arndb.de>
Thomas Bogendoerfer Oct. 6, 2023, 8:06 a.m. UTC | #2
On Thu, Sep 21, 2023 at 07:04:24PM +0800, Baoquan He wrote:
> By adding <asm-generic/io.h> support, the duplicated phys_to_virt
> can be removed to use the default version in <asm-gneneric/io.h>.
> 
> Meanwhile move isa_bus_to_virt() down below <asm-generic/io.h> including
> to fix the compiling error of missing phys_to_virt definition.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Helge Deller <deller@gmx.de>
> Cc: Serge Semin <fancer.lancer@gmail.com>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: Huacai Chen <chenhuacai@kernel.org>
> Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Cc: linux-mips@vger.kernel.org
> ---
>  arch/mips/include/asm/io.h | 28 +++++-----------------------
>  1 file changed, 5 insertions(+), 23 deletions(-)

Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
diff mbox series

Patch

diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index 1ecf255efb40..fe5476c1c689 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -117,24 +117,6 @@  static inline phys_addr_t virt_to_phys(const volatile void *x)
 	return __virt_to_phys(x);
 }
 
-/*
- *     phys_to_virt    -       map physical address to virtual
- *     @address: address to remap
- *
- *     The returned virtual address is a current CPU mapping for
- *     the memory address given. It is only valid to use this function on
- *     addresses that have a kernel mapping
- *
- *     This function does not handle bus mappings for DMA transfers. In
- *     almost all conceivable cases a device driver should not be using
- *     this function
- */
-#define phys_to_virt phys_to_virt
-static inline void * phys_to_virt(unsigned long address)
-{
-	return __va(address);
-}
-
 /*
  * ISA I/O bus memory addresses are 1:1 with the physical address.
  */
@@ -143,11 +125,6 @@  static inline unsigned long isa_virt_to_bus(volatile void *address)
 	return virt_to_phys(address);
 }
 
-static inline void *isa_bus_to_virt(unsigned long address)
-{
-	return phys_to_virt(address);
-}
-
 /*
  * Change "struct page" to physical address.
  */
@@ -596,4 +573,9 @@  void __ioread64_copy(void *to, const void __iomem *from, size_t count);
 
 #include <asm-generic/io.h>
 
+static inline void *isa_bus_to_virt(unsigned long address)
+{
+	return phys_to_virt(address);
+}
+
 #endif /* _ASM_IO_H */