diff mbox series

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

Message ID 20230706154520.11257-12-bhe@redhat.com (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Baoquan He July 6, 2023, 3:45 p.m. UTC
In <asm-generic/io.h>, it provides a generic implementation of all
I/O accessors.

For some port|mm io functions, SuperH has its own implementation
in arch/sh/kernel/iomap.c and arch/sh/include/asm/io_noioport.h.
These will conflict with those in <asm-generic/io.h> and cause compiling
error. Hence add macro definitions to ensure that the SuperH version
of them will override the generic version.

Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: linux-sh@vger.kernel.org
---
 arch/sh/include/asm/io.h          | 25 +++++++++++++++++++++++++
 arch/sh/include/asm/io_noioport.h |  7 +++++++
 2 files changed, 32 insertions(+)

Comments

Geert Uytterhoeven July 10, 2023, 8:17 a.m. UTC | #1
Hi Baoquan,

On Thu, Jul 6, 2023 at 5:49 PM Baoquan He <bhe@redhat.com> wrote:
> In <asm-generic/io.h>, it provides a generic implementation of all
> I/O accessors.
>
> For some port|mm io functions, SuperH has its own implementation
> in arch/sh/kernel/iomap.c and arch/sh/include/asm/io_noioport.h.
> These will conflict with those in <asm-generic/io.h> and cause compiling
> error. Hence add macro definitions to ensure that the SuperH version
> of them will override the generic version.
>
> Signed-off-by: Baoquan He <bhe@redhat.com>

Thanks for your patch, which is now commit edad4470b45298ba ("sh:
add <asm-generic/io.h> including") in next-20230710.

This break dreamcast_defconfig:

  CC      arch/sh/kernel/asm-offsets.s
In file included from ./arch/sh/include/asm/io.h:290,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:636:15: error: redefinition of ‘inb_p’
  636 | #define inb_p inb_p
      |               ^~~~~
./include/asm-generic/io.h:637:18: note: in expansion of macro ‘inb_p’
  637 | static inline u8 inb_p(unsigned long addr)
      |                  ^~~~~
In file included from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:185:25: note: previous definition of
‘inb_p’ with type ‘u8(long unsigned int)’ {aka ‘unsigned char(long
unsigned int)’}
  185 | static inline type pfx##in##bwlq##p(unsigned long port)
         \
      |                         ^~
./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
‘__BUILD_IOPORT_SINGLE’
  199 |         __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
      |         ^~~~~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
‘__BUILD_IOPORT_PFX’
  202 |         __BUILD_IOPORT_PFX(, bwlq, type)
      |         ^~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:204:1: note: in expansion of macro ‘BUILDIO_IOPORT’
  204 | BUILDIO_IOPORT(b, u8)
      | ^~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:644:15: error: redefinition of ‘inw_p’
  644 | #define inw_p inw_p
      |               ^~~~~
./include/asm-generic/io.h:645:19: note: in expansion of macro ‘inw_p’
  645 | static inline u16 inw_p(unsigned long addr)
      |                   ^~~~~
In file included from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:185:25: note: previous definition of
‘inw_p’ with type ‘u16(long unsigned int)’ {aka ‘short unsigned
int(long unsigned int)’}
  185 | static inline type pfx##in##bwlq##p(unsigned long port)
         \
      |                         ^~
./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
‘__BUILD_IOPORT_SINGLE’
  199 |         __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
      |         ^~~~~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
‘__BUILD_IOPORT_PFX’
  202 |         __BUILD_IOPORT_PFX(, bwlq, type)
      |         ^~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:205:1: note: in expansion of macro ‘BUILDIO_IOPORT’
  205 | BUILDIO_IOPORT(w, u16)
      | ^~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:652:15: error: redefinition of ‘inl_p’
  652 | #define inl_p inl_p
      |               ^~~~~
./include/asm-generic/io.h:653:19: note: in expansion of macro ‘inl_p’
  653 | static inline u32 inl_p(unsigned long addr)
      |                   ^~~~~
In file included from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:185:25: note: previous definition of
‘inl_p’ with type ‘u32(long unsigned int)’ {aka ‘unsigned int(long
unsigned int)’}
  185 | static inline type pfx##in##bwlq##p(unsigned long port)
         \
      |                         ^~
./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
‘__BUILD_IOPORT_SINGLE’
  199 |         __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
      |         ^~~~~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
‘__BUILD_IOPORT_PFX’
  202 |         __BUILD_IOPORT_PFX(, bwlq, type)
      |         ^~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:206:1: note: in expansion of macro ‘BUILDIO_IOPORT’
  206 | BUILDIO_IOPORT(l, u32)
      | ^~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:660:16: error: redefinition of ‘outb_p’
  660 | #define outb_p outb_p
      |                ^~~~~~
./include/asm-generic/io.h:661:20: note: in expansion of macro ‘outb_p’
  661 | static inline void outb_p(u8 value, unsigned long addr)
      |                    ^~~~~~
In file included from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:176:25: note: previous definition of
‘outb_p’ with type ‘void(u8,  long unsigned int)’ {aka ‘void(unsigned
char,  long unsigned int)’}
  176 | static inline void pfx##out##bwlq##p(type val, unsigned long
port)      \
      |                         ^~~
./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
‘__BUILD_IOPORT_SINGLE’
  199 |         __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
      |         ^~~~~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
‘__BUILD_IOPORT_PFX’
  202 |         __BUILD_IOPORT_PFX(, bwlq, type)
      |         ^~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:204:1: note: in expansion of macro ‘BUILDIO_IOPORT’
  204 | BUILDIO_IOPORT(b, u8)
      | ^~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:668:16: error: redefinition of ‘outw_p’
  668 | #define outw_p outw_p
      |                ^~~~~~
./include/asm-generic/io.h:669:20: note: in expansion of macro ‘outw_p’
  669 | static inline void outw_p(u16 value, unsigned long addr)
      |                    ^~~~~~
In file included from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:176:25: note: previous definition of
‘outw_p’ with type ‘void(u16,  long unsigned int)’ {aka ‘void(short
unsigned int,  long unsigned int)’}
  176 | static inline void pfx##out##bwlq##p(type val, unsigned long
port)      \
      |                         ^~~
./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
‘__BUILD_IOPORT_SINGLE’
  199 |         __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
      |         ^~~~~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
‘__BUILD_IOPORT_PFX’
  202 |         __BUILD_IOPORT_PFX(, bwlq, type)
      |         ^~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:205:1: note: in expansion of macro ‘BUILDIO_IOPORT’
  205 | BUILDIO_IOPORT(w, u16)
      | ^~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:676:16: error: redefinition of ‘outl_p’
  676 | #define outl_p outl_p
      |                ^~~~~~
./include/asm-generic/io.h:677:20: note: in expansion of macro ‘outl_p’
  677 | static inline void outl_p(u32 value, unsigned long addr)
      |                    ^~~~~~
In file included from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:176:25: note: previous definition of
‘outl_p’ with type ‘void(u32,  long unsigned int)’ {aka ‘void(unsigned
int,  long unsigned int)’}
  176 | static inline void pfx##out##bwlq##p(type val, unsigned long
port)      \
      |                         ^~~
./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
‘__BUILD_IOPORT_SINGLE’
  199 |         __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
      |         ^~~~~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
‘__BUILD_IOPORT_PFX’
  202 |         __BUILD_IOPORT_PFX(, bwlq, type)
      |         ^~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:206:1: note: in expansion of macro ‘BUILDIO_IOPORT’
  206 | BUILDIO_IOPORT(l, u32)
      | ^~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:689:14: error: redefinition of ‘insb’
  689 | #define insb insb
      |              ^~~~
./include/asm-generic/io.h:690:20: note: in expansion of macro ‘insb’
  690 | static inline void insb(unsigned long addr, void *buffer,
unsigned int count)
      |                    ^~~~
In file included from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:222:20: note: previous definition of ‘insb’
with type ‘void(long unsigned int,  void *, unsigned int)’
  222 | static inline void ins##bwlq(unsigned long port, void *addr,
         \
      |                    ^~~
./arch/sh/include/asm/io.h:233:1: note: in expansion of macro
‘__BUILD_IOPORT_STRING’
  233 | __BUILD_IOPORT_STRING(b, u8)
      | ^~~~~~~~~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:697:14: error: redefinition of ‘insw’
  697 | #define insw insw
      |              ^~~~
./include/asm-generic/io.h:698:20: note: in expansion of macro ‘insw’
  698 | static inline void insw(unsigned long addr, void *buffer,
unsigned int count)
      |                    ^~~~
In file included from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:222:20: note: previous definition of ‘insw’
with type ‘void(long unsigned int,  void *, unsigned int)’
  222 | static inline void ins##bwlq(unsigned long port, void *addr,
         \
      |                    ^~~
./arch/sh/include/asm/io.h:234:1: note: in expansion of macro
‘__BUILD_IOPORT_STRING’
  234 | __BUILD_IOPORT_STRING(w, u16)
      | ^~~~~~~~~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:705:14: error: redefinition of ‘insl’
  705 | #define insl insl
      |              ^~~~
./include/asm-generic/io.h:706:20: note: in expansion of macro ‘insl’
  706 | static inline void insl(unsigned long addr, void *buffer,
unsigned int count)
      |                    ^~~~
In file included from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:222:20: note: previous definition of ‘insl’
with type ‘void(long unsigned int,  void *, unsigned int)’
  222 | static inline void ins##bwlq(unsigned long port, void *addr,
         \
      |                    ^~~
./arch/sh/include/asm/io.h:235:1: note: in expansion of macro
‘__BUILD_IOPORT_STRING’
  235 | __BUILD_IOPORT_STRING(l, u32)
      | ^~~~~~~~~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:713:15: error: redefinition of ‘outsb’
  713 | #define outsb outsb
      |               ^~~~~
./include/asm-generic/io.h:714:20: note: in expansion of macro ‘outsb’
  714 | static inline void outsb(unsigned long addr, const void *buffer,
      |                    ^~~~~
In file included from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:211:20: note: previous definition of
‘outsb’ with type ‘void(long unsigned int,  const void *, unsigned
int)’
  211 | static inline void outs##bwlq(unsigned long port, const void
*addr,     \
      |                    ^~~~
./arch/sh/include/asm/io.h:233:1: note: in expansion of macro
‘__BUILD_IOPORT_STRING’
  233 | __BUILD_IOPORT_STRING(b, u8)
      | ^~~~~~~~~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:722:15: error: redefinition of ‘outsw’
  722 | #define outsw outsw
      |               ^~~~~
./include/asm-generic/io.h:723:20: note: in expansion of macro ‘outsw’
  723 | static inline void outsw(unsigned long addr, const void *buffer,
      |                    ^~~~~
In file included from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:211:20: note: previous definition of
‘outsw’ with type ‘void(long unsigned int,  const void *, unsigned
int)’
  211 | static inline void outs##bwlq(unsigned long port, const void
*addr,     \
      |                    ^~~~
./arch/sh/include/asm/io.h:234:1: note: in expansion of macro
‘__BUILD_IOPORT_STRING’
  234 | __BUILD_IOPORT_STRING(w, u16)
      | ^~~~~~~~~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:731:15: error: redefinition of ‘outsl’
  731 | #define outsl outsl
      |               ^~~~~
./include/asm-generic/io.h:732:20: note: in expansion of macro ‘outsl’
  732 | static inline void outsl(unsigned long addr, const void *buffer,
      |                    ^~~~~
In file included from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:211:20: note: previous definition of
‘outsl’ with type ‘void(long unsigned int,  const void *, unsigned
int)’
  211 | static inline void outs##bwlq(unsigned long port, const void
*addr,     \
      |                    ^~~~
./arch/sh/include/asm/io.h:235:1: note: in expansion of macro
‘__BUILD_IOPORT_STRING’
  235 | __BUILD_IOPORT_STRING(l, u32)
      | ^~~~~~~~~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:1111:20: error: static declaration of
‘ioport_map’ follows non-static declaration
 1111 | #define ioport_map ioport_map
      |                    ^~~~~~~~~~
./include/asm-generic/io.h:1112:29: note: in expansion of macro ‘ioport_map’
 1112 | static inline void __iomem *ioport_map(unsigned long port,
unsigned int nr)
      |                             ^~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:22,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/iomap.h:92:22: note: previous declaration of
‘ioport_map’ with type ‘void *(long unsigned int,  unsigned int)’
   92 | extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
      |                      ^~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:1121:22: error: static declaration of
‘ioport_unmap’ follows non-static declaration
 1121 | #define ioport_unmap ioport_unmap
      |                      ^~~~~~~~~~~~
./include/asm-generic/io.h:1122:20: note: in expansion of macro ‘ioport_unmap’
 1122 | static inline void ioport_unmap(void __iomem *p)
      |                    ^~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:22,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/sh/include/asm/hardirq.h:9,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/linux/suspend.h:5,
                 from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/iomap.h:93:13: note: previous declaration of
‘ioport_unmap’ with type ‘void(void *)’
   93 | extern void ioport_unmap(void __iomem *);
      |             ^~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:116: arch/sh/kernel/asm-offsets.s] Error 1
make[1]: *** [Makefile:1275: prepare0] Error 2
make: *** [Makefile:234: __sub-make] Error 2

> --- 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();
> --
> 2.34.1
>
John Paul Adrian Glaubitz July 10, 2023, 8:45 a.m. UTC | #2
Hi!

On Mon, 2023-07-10 at 10:17 +0200, Geert Uytterhoeven wrote:
> Hi Baoquan,
> 
> On Thu, Jul 6, 2023 at 5:49 PM Baoquan He <bhe@redhat.com> wrote:
> > In <asm-generic/io.h>, it provides a generic implementation of all
> > I/O accessors.
> > 
> > For some port|mm io functions, SuperH has its own implementation
> > in arch/sh/kernel/iomap.c and arch/sh/include/asm/io_noioport.h.
> > These will conflict with those in <asm-generic/io.h> and cause compiling
> > error. Hence add macro definitions to ensure that the SuperH version
> > of them will override the generic version.
> > 
> > Signed-off-by: Baoquan He <bhe@redhat.com>
> 
> Thanks for your patch, which is now commit edad4470b45298ba ("sh:
> add <asm-generic/io.h> including") in next-20230710.
> 
> This break dreamcast_defconfig:
> 
>   CC      arch/sh/kernel/asm-offsets.s
> In file included from ./arch/sh/include/asm/io.h:290,
>                  from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:636:15: error: redefinition of ‘inb_p’
>   636 | #define inb_p inb_p
>       |               ^~~~~
> ./include/asm-generic/io.h:637:18: note: in expansion of macro ‘inb_p’
>   637 | static inline u8 inb_p(unsigned long addr)
>       |                  ^~~~~
> In file included from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:185:25: note: previous definition of
> ‘inb_p’ with type ‘u8(long unsigned int)’ {aka ‘unsigned char(long
> unsigned int)’}
>   185 | static inline type pfx##in##bwlq##p(unsigned long port)
>          \
>       |                         ^~
> ./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
> ‘__BUILD_IOPORT_SINGLE’
>   199 |         __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
>       |         ^~~~~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
> ‘__BUILD_IOPORT_PFX’
>   202 |         __BUILD_IOPORT_PFX(, bwlq, type)
>       |         ^~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:204:1: note: in expansion of macro ‘BUILDIO_IOPORT’
>   204 | BUILDIO_IOPORT(b, u8)
>       | ^~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
>                  from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:644:15: error: redefinition of ‘inw_p’
>   644 | #define inw_p inw_p
>       |               ^~~~~
> ./include/asm-generic/io.h:645:19: note: in expansion of macro ‘inw_p’
>   645 | static inline u16 inw_p(unsigned long addr)
>       |                   ^~~~~
> In file included from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:185:25: note: previous definition of
> ‘inw_p’ with type ‘u16(long unsigned int)’ {aka ‘short unsigned
> int(long unsigned int)’}
>   185 | static inline type pfx##in##bwlq##p(unsigned long port)
>          \
>       |                         ^~
> ./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
> ‘__BUILD_IOPORT_SINGLE’
>   199 |         __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
>       |         ^~~~~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
> ‘__BUILD_IOPORT_PFX’
>   202 |         __BUILD_IOPORT_PFX(, bwlq, type)
>       |         ^~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:205:1: note: in expansion of macro ‘BUILDIO_IOPORT’
>   205 | BUILDIO_IOPORT(w, u16)
>       | ^~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
>                  from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:652:15: error: redefinition of ‘inl_p’
>   652 | #define inl_p inl_p
>       |               ^~~~~
> ./include/asm-generic/io.h:653:19: note: in expansion of macro ‘inl_p’
>   653 | static inline u32 inl_p(unsigned long addr)
>       |                   ^~~~~
> In file included from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:185:25: note: previous definition of
> ‘inl_p’ with type ‘u32(long unsigned int)’ {aka ‘unsigned int(long
> unsigned int)’}
>   185 | static inline type pfx##in##bwlq##p(unsigned long port)
>          \
>       |                         ^~
> ./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
> ‘__BUILD_IOPORT_SINGLE’
>   199 |         __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
>       |         ^~~~~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
> ‘__BUILD_IOPORT_PFX’
>   202 |         __BUILD_IOPORT_PFX(, bwlq, type)
>       |         ^~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:206:1: note: in expansion of macro ‘BUILDIO_IOPORT’
>   206 | BUILDIO_IOPORT(l, u32)
>       | ^~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
>                  from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:660:16: error: redefinition of ‘outb_p’
>   660 | #define outb_p outb_p
>       |                ^~~~~~
> ./include/asm-generic/io.h:661:20: note: in expansion of macro ‘outb_p’
>   661 | static inline void outb_p(u8 value, unsigned long addr)
>       |                    ^~~~~~
> In file included from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:176:25: note: previous definition of
> ‘outb_p’ with type ‘void(u8,  long unsigned int)’ {aka ‘void(unsigned
> char,  long unsigned int)’}
>   176 | static inline void pfx##out##bwlq##p(type val, unsigned long
> port)      \
>       |                         ^~~
> ./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
> ‘__BUILD_IOPORT_SINGLE’
>   199 |         __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
>       |         ^~~~~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
> ‘__BUILD_IOPORT_PFX’
>   202 |         __BUILD_IOPORT_PFX(, bwlq, type)
>       |         ^~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:204:1: note: in expansion of macro ‘BUILDIO_IOPORT’
>   204 | BUILDIO_IOPORT(b, u8)
>       | ^~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
>                  from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:668:16: error: redefinition of ‘outw_p’
>   668 | #define outw_p outw_p
>       |                ^~~~~~
> ./include/asm-generic/io.h:669:20: note: in expansion of macro ‘outw_p’
>   669 | static inline void outw_p(u16 value, unsigned long addr)
>       |                    ^~~~~~
> In file included from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:176:25: note: previous definition of
> ‘outw_p’ with type ‘void(u16,  long unsigned int)’ {aka ‘void(short
> unsigned int,  long unsigned int)’}
>   176 | static inline void pfx##out##bwlq##p(type val, unsigned long
> port)      \
>       |                         ^~~
> ./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
> ‘__BUILD_IOPORT_SINGLE’
>   199 |         __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
>       |         ^~~~~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
> ‘__BUILD_IOPORT_PFX’
>   202 |         __BUILD_IOPORT_PFX(, bwlq, type)
>       |         ^~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:205:1: note: in expansion of macro ‘BUILDIO_IOPORT’
>   205 | BUILDIO_IOPORT(w, u16)
>       | ^~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
>                  from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:676:16: error: redefinition of ‘outl_p’
>   676 | #define outl_p outl_p
>       |                ^~~~~~
> ./include/asm-generic/io.h:677:20: note: in expansion of macro ‘outl_p’
>   677 | static inline void outl_p(u32 value, unsigned long addr)
>       |                    ^~~~~~
> In file included from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:176:25: note: previous definition of
> ‘outl_p’ with type ‘void(u32,  long unsigned int)’ {aka ‘void(unsigned
> int,  long unsigned int)’}
>   176 | static inline void pfx##out##bwlq##p(type val, unsigned long
> port)      \
>       |                         ^~~
> ./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
> ‘__BUILD_IOPORT_SINGLE’
>   199 |         __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
>       |         ^~~~~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
> ‘__BUILD_IOPORT_PFX’
>   202 |         __BUILD_IOPORT_PFX(, bwlq, type)
>       |         ^~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:206:1: note: in expansion of macro ‘BUILDIO_IOPORT’
>   206 | BUILDIO_IOPORT(l, u32)
>       | ^~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
>                  from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:689:14: error: redefinition of ‘insb’
>   689 | #define insb insb
>       |              ^~~~
> ./include/asm-generic/io.h:690:20: note: in expansion of macro ‘insb’
>   690 | static inline void insb(unsigned long addr, void *buffer,
> unsigned int count)
>       |                    ^~~~
> In file included from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:222:20: note: previous definition of ‘insb’
> with type ‘void(long unsigned int,  void *, unsigned int)’
>   222 | static inline void ins##bwlq(unsigned long port, void *addr,
>          \
>       |                    ^~~
> ./arch/sh/include/asm/io.h:233:1: note: in expansion of macro
> ‘__BUILD_IOPORT_STRING’
>   233 | __BUILD_IOPORT_STRING(b, u8)
>       | ^~~~~~~~~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
>                  from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:697:14: error: redefinition of ‘insw’
>   697 | #define insw insw
>       |              ^~~~
> ./include/asm-generic/io.h:698:20: note: in expansion of macro ‘insw’
>   698 | static inline void insw(unsigned long addr, void *buffer,
> unsigned int count)
>       |                    ^~~~
> In file included from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:222:20: note: previous definition of ‘insw’
> with type ‘void(long unsigned int,  void *, unsigned int)’
>   222 | static inline void ins##bwlq(unsigned long port, void *addr,
>          \
>       |                    ^~~
> ./arch/sh/include/asm/io.h:234:1: note: in expansion of macro
> ‘__BUILD_IOPORT_STRING’
>   234 | __BUILD_IOPORT_STRING(w, u16)
>       | ^~~~~~~~~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
>                  from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:705:14: error: redefinition of ‘insl’
>   705 | #define insl insl
>       |              ^~~~
> ./include/asm-generic/io.h:706:20: note: in expansion of macro ‘insl’
>   706 | static inline void insl(unsigned long addr, void *buffer,
> unsigned int count)
>       |                    ^~~~
> In file included from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:222:20: note: previous definition of ‘insl’
> with type ‘void(long unsigned int,  void *, unsigned int)’
>   222 | static inline void ins##bwlq(unsigned long port, void *addr,
>          \
>       |                    ^~~
> ./arch/sh/include/asm/io.h:235:1: note: in expansion of macro
> ‘__BUILD_IOPORT_STRING’
>   235 | __BUILD_IOPORT_STRING(l, u32)
>       | ^~~~~~~~~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
>                  from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:713:15: error: redefinition of ‘outsb’
>   713 | #define outsb outsb
>       |               ^~~~~
> ./include/asm-generic/io.h:714:20: note: in expansion of macro ‘outsb’
>   714 | static inline void outsb(unsigned long addr, const void *buffer,
>       |                    ^~~~~
> In file included from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:211:20: note: previous definition of
> ‘outsb’ with type ‘void(long unsigned int,  const void *, unsigned
> int)’
>   211 | static inline void outs##bwlq(unsigned long port, const void
> *addr,     \
>       |                    ^~~~
> ./arch/sh/include/asm/io.h:233:1: note: in expansion of macro
> ‘__BUILD_IOPORT_STRING’
>   233 | __BUILD_IOPORT_STRING(b, u8)
>       | ^~~~~~~~~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
>                  from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:722:15: error: redefinition of ‘outsw’
>   722 | #define outsw outsw
>       |               ^~~~~
> ./include/asm-generic/io.h:723:20: note: in expansion of macro ‘outsw’
>   723 | static inline void outsw(unsigned long addr, const void *buffer,
>       |                    ^~~~~
> In file included from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:211:20: note: previous definition of
> ‘outsw’ with type ‘void(long unsigned int,  const void *, unsigned
> int)’
>   211 | static inline void outs##bwlq(unsigned long port, const void
> *addr,     \
>       |                    ^~~~
> ./arch/sh/include/asm/io.h:234:1: note: in expansion of macro
> ‘__BUILD_IOPORT_STRING’
>   234 | __BUILD_IOPORT_STRING(w, u16)
>       | ^~~~~~~~~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
>                  from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:731:15: error: redefinition of ‘outsl’
>   731 | #define outsl outsl
>       |               ^~~~~
> ./include/asm-generic/io.h:732:20: note: in expansion of macro ‘outsl’
>   732 | static inline void outsl(unsigned long addr, const void *buffer,
>       |                    ^~~~~
> In file included from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:211:20: note: previous definition of
> ‘outsl’ with type ‘void(long unsigned int,  const void *, unsigned
> int)’
>   211 | static inline void outs##bwlq(unsigned long port, const void
> *addr,     \
>       |                    ^~~~
> ./arch/sh/include/asm/io.h:235:1: note: in expansion of macro
> ‘__BUILD_IOPORT_STRING’
>   235 | __BUILD_IOPORT_STRING(l, u32)
>       | ^~~~~~~~~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
>                  from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:1111:20: error: static declaration of
> ‘ioport_map’ follows non-static declaration
>  1111 | #define ioport_map ioport_map
>       |                    ^~~~~~~~~~
> ./include/asm-generic/io.h:1112:29: note: in expansion of macro ‘ioport_map’
>  1112 | static inline void __iomem *ioport_map(unsigned long port,
> unsigned int nr)
>       |                             ^~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:22,
>                  from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/iomap.h:92:22: note: previous declaration of
> ‘ioport_map’ with type ‘void *(long unsigned int,  unsigned int)’
>    92 | extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
>       |                      ^~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
>                  from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:1121:22: error: static declaration of
> ‘ioport_unmap’ follows non-static declaration
>  1121 | #define ioport_unmap ioport_unmap
>       |                      ^~~~~~~~~~~~
> ./include/asm-generic/io.h:1122:20: note: in expansion of macro ‘ioport_unmap’
>  1122 | static inline void ioport_unmap(void __iomem *p)
>       |                    ^~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:22,
>                  from ./include/linux/io.h:13,
>                  from ./include/linux/irq.h:20,
>                  from ./include/asm-generic/hardirq.h:17,
>                  from ./arch/sh/include/asm/hardirq.h:9,
>                  from ./include/linux/hardirq.h:11,
>                  from ./include/linux/interrupt.h:11,
>                  from ./include/linux/kernel_stat.h:9,
>                  from ./include/linux/cgroup.h:26,
>                  from ./include/linux/memcontrol.h:13,
>                  from ./include/linux/swap.h:9,
>                  from ./include/linux/suspend.h:5,
>                  from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/iomap.h:93:13: note: previous declaration of
> ‘ioport_unmap’ with type ‘void(void *)’
>    93 | extern void ioport_unmap(void __iomem *);
>       |             ^~~~~~~~~~~~
> make[2]: *** [scripts/Makefile.build:116: arch/sh/kernel/asm-offsets.s] Error 1
> make[1]: *** [Makefile:1275: prepare0] Error 2
> make: *** [Makefile:234: __sub-make] Error 2
> 
> > --- 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();
> > --
> > 2.34.1

I'm not happy though that this patch is in linux-next without being Acked by me
or being reviewed by anyone. We should always make sure first that the code
actually builds and has been tested on real hardware.

Adrian
Arnd Bergmann July 10, 2023, 10:47 a.m. UTC | #3
On Mon, Jul 10, 2023, at 10:45, John Paul Adrian Glaubitz wrote:
> On Mon, 2023-07-10 at 10:17 +0200, Geert Uytterhoeven wrote:
>> Thanks for your patch, which is now commit edad4470b45298ba ("sh:
>> add <asm-generic/io.h> including") in next-20230710.
>> 
>> This break dreamcast_defconfig:
>> 
>>   CC      arch/sh/kernel/asm-offsets.s
>> In file included from ./arch/sh/include/asm/io.h:290,
>> ./include/asm-generic/io.h:636:15: error: redefinition of ‘inb_p’
>>   636 | #define inb_p inb_p
>>       |               ^~~~~

>> > 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

It looks like only the "noioport" variant got some of the
extra macro definitions, but the version for PCI still needs the
same six macros, plus the ones of inb/outb etc, something like
this:

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 24c560c065ec7..2135e32145c54 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -241,6 +241,26 @@ __BUILD_IOPORT_STRING(q, u64)
 
 #endif
 
+#define inb(addr)      inb(addr)
+#define inw(addr)      inw(addr)
+#define inl(addr)      inl(addr)
+#define outb(x, addr)  outb((x), (addr))
+#define outw(x, addr)  outw((x), (addr))
+#define outl(x, addr)  outl((x), (addr))
+
+#define inb_p(addr)    inb(addr)
+#define inw_p(addr)    inw(addr)
+#define inl_p(addr)    inl(addr)
+#define outb_p(x, addr)        outb((x), (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
 
 #define IO_SPACE_LIMIT 0xffffffff
 
diff --git a/arch/sh/include/asm/io_noioport.h b/arch/sh/include/asm/io_noioport.h
index 5ba4116b4265c..12dad91f41c1e 100644
--- a/arch/sh/include/asm/io_noioport.h
+++ b/arch/sh/include/asm/io_noioport.h
@@ -46,20 +46,6 @@ static inline void ioport_unmap(void __iomem *addr)
        BUG();
 }
 
-#define inb_p(addr)    inb(addr)
-#define inw_p(addr)    inw(addr)
-#define inl_p(addr)    inl(addr)
-#define outb_p(x, addr)        outb((x), (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();

I think ideally all the I/O port stuff in arch/sh/ could just be
removed after the conversion to asm-generic/io.h, but the
microdev_ioport_map() function oddity gets in the way of that,
unless someone wants to clean up that platform. As far as I
can tell, the ethernet, display, USB and PCI devices on it already
broke at some point (afbb9d8d5266b, 46bc85872040a), so it might
be easier to remove it entirely.

> I'm not happy though that this patch is in linux-next without being Acked by me
> or being reviewed by anyone. We should always make sure first that the code
> actually builds and has been tested on real hardware.

I think that if the series has been posted eight times, you had
your chance to do a review, especially since I pointed out that
merging this one would have avoid the unxlate_dev_mem_ptr() bug
as well.

Having the series go into linux-next sounds appropriate like this,
the entire purpose of that is to find such bugs and Andrew can jus
fold the fixup into the broken patch. 

Let me know if you prefer the simple version with the extra
#defines or if we should just use the generic inb/outb implementation
immediately and drop microdev in a separate patch.

      Arnd
John Paul Adrian Glaubitz Aug. 1, 2023, 7:21 p.m. UTC | #4
Hi Arnd!

On Mon, 2023-07-10 at 12:47 +0200, Arnd Bergmann wrote:
> It looks like only the "noioport" variant got some of the
> extra macro definitions, but the version for PCI still needs the
> same six macros, plus the ones of inb/outb etc, something like
> this:
> 
> diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
> index 24c560c065ec7..2135e32145c54 100644
> --- a/arch/sh/include/asm/io.h
> +++ b/arch/sh/include/asm/io.h
> @@ -241,6 +241,26 @@ __BUILD_IOPORT_STRING(q, u64)
>  
>  #endif
>  
> +#define inb(addr)      inb(addr)
> +#define inw(addr)      inw(addr)
> +#define inl(addr)      inl(addr)
> +#define outb(x, addr)  outb((x), (addr))
> +#define outw(x, addr)  outw((x), (addr))
> +#define outl(x, addr)  outl((x), (addr))
> +
> +#define inb_p(addr)    inb(addr)
> +#define inw_p(addr)    inw(addr)
> +#define inl_p(addr)    inl(addr)
> +#define outb_p(x, addr)        outb((x), (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
>  
>  #define IO_SPACE_LIMIT 0xffffffff
>  
> diff --git a/arch/sh/include/asm/io_noioport.h b/arch/sh/include/asm/io_noioport.h
> index 5ba4116b4265c..12dad91f41c1e 100644
> --- a/arch/sh/include/asm/io_noioport.h
> +++ b/arch/sh/include/asm/io_noioport.h
> @@ -46,20 +46,6 @@ static inline void ioport_unmap(void __iomem *addr)
>         BUG();
>  }
>  
> -#define inb_p(addr)    inb(addr)
> -#define inw_p(addr)    inw(addr)
> -#define inl_p(addr)    inl(addr)
> -#define outb_p(x, addr)        outb((x), (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();

I am fine with this fix.

Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>

> I think ideally all the I/O port stuff in arch/sh/ could just be
> removed after the conversion to asm-generic/io.h, but the
> microdev_ioport_map() function oddity gets in the way of that,
> unless someone wants to clean up that platform. As far as I
> can tell, the ethernet, display, USB and PCI devices on it already
> broke at some point (afbb9d8d5266b, 46bc85872040a), so it might
> be easier to remove it entirely.

I don't have this particular hardware, so I cannot comment on this.

> > I'm not happy though that this patch is in linux-next without being Acked by me
> > or being reviewed by anyone. We should always make sure first that the code
> > actually builds and has been tested on real hardware.
> 
> I think that if the series has been posted eight times, you had
> your chance to do a review, especially since I pointed out that
> merging this one would have avoid the unxlate_dev_mem_ptr() bug
> as well.

I have only been the maintainer of arch/sh for a few weeks, so it's natural
that I am not doing a perfect job and might miss something. Also, I am not
getting paid for this work, I am doing this in my free time.

> Having the series go into linux-next sounds appropriate like this,
> the entire purpose of that is to find such bugs and Andrew can jus
> fold the fixup into the broken patch. 
> 
> Let me know if you prefer the simple version with the extra
> #defines or if we should just use the generic inb/outb implementation
> immediately and drop microdev in a separate patch.

Please go ahead with the simple version.

Thanks,
Adrian
Arnd Bergmann Aug. 2, 2023, 2:19 p.m. UTC | #5
On Tue, Aug 1, 2023, at 21:21, John Paul Adrian Glaubitz wrote:

>> I think ideally all the I/O port stuff in arch/sh/ could just be
>> removed after the conversion to asm-generic/io.h, but the
>> microdev_ioport_map() function oddity gets in the way of that,
>> unless someone wants to clean up that platform. As far as I
>> can tell, the ethernet, display, USB and PCI devices on it already
>> broke at some point (afbb9d8d5266b, 46bc85872040a), so it might
>> be easier to remove it entirely.
>
> I don't have this particular hardware, so I cannot comment on this.

Sure, as I explained, I'm pretty sure that nobody has
tried to boot this hardware in a long time, so I did not
expect you to have one.

I'll try to follow up with a patch to remove the platform
later on, based on the explations above.

>> Having the series go into linux-next sounds appropriate like this,
>> the entire purpose of that is to find such bugs and Andrew can jus
>> fold the fixup into the broken patch. 
>> 
>> Let me know if you prefer the simple version with the extra
>> #defines or if we should just use the generic inb/outb implementation
>> immediately and drop microdev in a separate patch.
>
> Please go ahead with the simple version.

Done,

     Arnd
John Paul Adrian Glaubitz Aug. 2, 2023, 5:28 p.m. UTC | #6
Hello Arnd!

On Wed, 2023-08-02 at 16:19 +0200, Arnd Bergmann wrote:
> On Tue, Aug 1, 2023, at 21:21, John Paul Adrian Glaubitz wrote:
> 
> > > I think ideally all the I/O port stuff in arch/sh/ could just be
> > > removed after the conversion to asm-generic/io.h, but the
> > > microdev_ioport_map() function oddity gets in the way of that,
> > > unless someone wants to clean up that platform. As far as I
> > > can tell, the ethernet, display, USB and PCI devices on it already
> > > broke at some point (afbb9d8d5266b, 46bc85872040a), so it might
> > > be easier to remove it entirely.
> > 
> > I don't have this particular hardware, so I cannot comment on this.
> 
> Sure, as I explained, I'm pretty sure that nobody has
> tried to boot this hardware in a long time, so I did not
> expect you to have one.
> 
> I'll try to follow up with a patch to remove the platform
> later on, based on the explations above.

There is no need to remove any platforms now as we're working on converting
arch/sh to device trees anyway and will eventually get rid of all the board-
specific code during that step.

> > > Having the series go into linux-next sounds appropriate like this,
> > > the entire purpose of that is to find such bugs and Andrew can jus
> > > fold the fixup into the broken patch. 
> > > 
> > > Let me know if you prefer the simple version with the extra
> > > #defines or if we should just use the generic inb/outb implementation
> > > immediately and drop microdev in a separate patch.
> > 
> > Please go ahead with the simple version.
> 
> Done,

Thanks,
Adrian
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();