diff mbox series

[v6,11/19] sh: add <asm-generic/io.h> including

Message ID 20230609075528.9390-12-bhe@redhat.com (mailing list archive)
State New
Headers show
Series mm: ioremap: Convert architectures to take GENERIC_IOREMAP way | expand

Commit Message

Baoquan He June 9, 2023, 7:55 a.m. UTC
Also add macro definitions for port|mm io functions since SuperH
has its own implementation in arch/sh/kernel/iomap.c and
arch/sh/include/asm/io_noioport.h. These will conflict with the port|mm io
function definitions in include/asm-generic/io.h to cause compiling
errors like below:

====
  CC      arch/sh/kernel/asm-offsets.s
In file included from ./arch/sh/include/asm/io.h:294,
                 from ./include/linux/io.h:13,
                 ......
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:792:17: error: conflicting types for ‘ioread8’
  792 | #define ioread8 ioread8
      |                 ^~~~~~~
./include/asm-generic/io.h:793:18: note: in expansion of macro ‘ioread8’
  793 | static inline u8 ioread8(const volatile void __iomem *addr)
      |                  ^~~~~~~
In file included from ./arch/sh/include/asm/io.h:22,
                 from ./include/linux/io.h:13,
                 ......
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/iomap.h:29:21: note: previous declaration of ‘ioread8’ was here
   29 | extern unsigned int ioread8(const void __iomem *);
====

Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: linux-sh@vger.kernel.org
---
v5->v6:
  split that inclusion of include/asm-generic/io.h and redefining of the
  helpers from the old patch 11 into this prep patch - Christoph

 arch/sh/include/asm/io.h          | 25 +++++++++++++++++++++++++
 arch/sh/include/asm/io_noioport.h |  7 +++++++
 2 files changed, 32 insertions(+)

Comments

John Paul Adrian Glaubitz June 9, 2023, 8:10 a.m. UTC | #1
Hello Baoquan!

On Fri, 2023-06-09 at 15:55 +0800, Baoquan He wrote:
> Also add macro definitions for port|mm io functions since SuperH
> has its own implementation in arch/sh/kernel/iomap.c and
> arch/sh/include/asm/io_noioport.h. These will conflict with the port|mm io
> function definitions in include/asm-generic/io.h to cause compiling
> errors like below:

What change does the "Also" refer to?

Adrian
Baoquan He June 9, 2023, 8:34 a.m. UTC | #2
On 06/09/23 at 10:10am, John Paul Adrian Glaubitz wrote:
> Hello Baoquan!
> 
> On Fri, 2023-06-09 at 15:55 +0800, Baoquan He wrote:
> > Also add macro definitions for port|mm io functions since SuperH
> > has its own implementation in arch/sh/kernel/iomap.c and
> > arch/sh/include/asm/io_noioport.h. These will conflict with the port|mm io
> > function definitions in include/asm-generic/io.h to cause compiling
> > errors like below:
> 
> What change does the "Also" refer to?

It refers to these kind of macro definitions, this place and those in
other several places. Please correct me if I misused the expression to
cause confusion.

+#define ioread8 ioread8
+#define ioread16 ioread16
+#define ioread16be ioread16be
+#define ioread32 ioread32
+#define ioread32be ioread32be
+
+#define iowrite8 iowrite8
+#define iowrite16 iowrite16
+#define iowrite16be iowrite16be
+#define iowrite32 iowrite32
+#define iowrite32be iowrite32be
+
+#define ioread8_rep ioread8_rep
+#define ioread16_rep ioread16_rep
+#define ioread32_rep ioread32_rep
+
+#define iowrite8_rep iowrite8_rep
+#define iowrite16_rep iowrite16_rep
+#define iowrite32_rep iowrite32_rep
diff mbox series

Patch

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index fba90e670ed4..270e7952950c 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -119,6 +119,26 @@  void __raw_readsl(const void __iomem *addr, void *data, int longlen);
 
 __BUILD_MEMORY_STRING(__raw_, q, u64)
 
+#define ioread8 ioread8
+#define ioread16 ioread16
+#define ioread16be ioread16be
+#define ioread32 ioread32
+#define ioread32be ioread32be
+
+#define iowrite8 iowrite8
+#define iowrite16 iowrite16
+#define iowrite16be iowrite16be
+#define iowrite32 iowrite32
+#define iowrite32be iowrite32be
+
+#define ioread8_rep ioread8_rep
+#define ioread16_rep ioread16_rep
+#define ioread32_rep ioread32_rep
+
+#define iowrite8_rep iowrite8_rep
+#define iowrite16_rep iowrite16_rep
+#define iowrite32_rep iowrite32_rep
+
 #ifdef CONFIG_HAS_IOPORT_MAP
 
 /*
@@ -225,6 +245,9 @@  __BUILD_IOPORT_STRING(q, u64)
 #define IO_SPACE_LIMIT 0xffffffff
 
 /* We really want to try and get these to memcpy etc */
+#define memset_io memset_io
+#define memcpy_fromio memcpy_fromio
+#define memcpy_toio memcpy_toio
 void memcpy_fromio(void *, const volatile void __iomem *, unsigned long);
 void memcpy_toio(volatile void __iomem *, const void *, unsigned long);
 void memset_io(volatile void __iomem *, int, unsigned long);
@@ -287,6 +310,8 @@  static inline void iounmap(volatile void __iomem *addr) { }
  */
 #define xlate_dev_mem_ptr(p)	__va(p)
 
+#include <asm-generic/io.h>
+
 #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
 int valid_phys_addr_range(phys_addr_t addr, size_t size);
 int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
diff --git a/arch/sh/include/asm/io_noioport.h b/arch/sh/include/asm/io_noioport.h
index f7938fe0f911..5ba4116b4265 100644
--- a/arch/sh/include/asm/io_noioport.h
+++ b/arch/sh/include/asm/io_noioport.h
@@ -53,6 +53,13 @@  static inline void ioport_unmap(void __iomem *addr)
 #define outw_p(x, addr)	outw((x), (addr))
 #define outl_p(x, addr)	outl((x), (addr))
 
+#define insb insb
+#define insw insw
+#define insl insl
+#define outsb outsb
+#define outsw outsw
+#define outsl outsl
+
 static inline void insb(unsigned long port, void *dst, unsigned long count)
 {
 	BUG();