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

sh: add <asm-generic/io.h> including

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.

[arnd@arndb.de: fix asm-generic/io.h inclusion]
Link: https://lkml.kernel.org/r/20230802141658.2064864-1-arnd@kernel.org
Link: https://lkml.kernel.org/r/20230706154520.11257-12-bhe@redhat.com
Signed-off-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Brian Cain <bcain@quicinc.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Chris Zankel <chris@zankel.net>
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Niklas Schnelle <schnelle@linux.ibm.com>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Baoquan He and committed by
Andrew Morton
b94692e8 b43b3fff

+49 -7
+49
arch/sh/include/asm/io.h
··· 119 119 120 120 __BUILD_MEMORY_STRING(__raw_, q, u64) 121 121 122 + #define ioport_map ioport_map 123 + #define ioport_unmap ioport_unmap 124 + #define pci_iounmap pci_iounmap 125 + 126 + #define ioread8 ioread8 127 + #define ioread16 ioread16 128 + #define ioread16be ioread16be 129 + #define ioread32 ioread32 130 + #define ioread32be ioread32be 131 + 132 + #define iowrite8 iowrite8 133 + #define iowrite16 iowrite16 134 + #define iowrite16be iowrite16be 135 + #define iowrite32 iowrite32 136 + #define iowrite32be iowrite32be 137 + 138 + #define ioread8_rep ioread8_rep 139 + #define ioread16_rep ioread16_rep 140 + #define ioread32_rep ioread32_rep 141 + 142 + #define iowrite8_rep iowrite8_rep 143 + #define iowrite16_rep iowrite16_rep 144 + #define iowrite32_rep iowrite32_rep 145 + 122 146 #ifdef CONFIG_HAS_IOPORT_MAP 123 147 124 148 /* ··· 245 221 246 222 #endif 247 223 224 + #define inb(addr) inb(addr) 225 + #define inw(addr) inw(addr) 226 + #define inl(addr) inl(addr) 227 + #define outb(x, addr) outb((x), (addr)) 228 + #define outw(x, addr) outw((x), (addr)) 229 + #define outl(x, addr) outl((x), (addr)) 230 + 231 + #define inb_p(addr) inb(addr) 232 + #define inw_p(addr) inw(addr) 233 + #define inl_p(addr) inl(addr) 234 + #define outb_p(x, addr) outb((x), (addr)) 235 + #define outw_p(x, addr) outw((x), (addr)) 236 + #define outl_p(x, addr) outl((x), (addr)) 237 + 238 + #define insb insb 239 + #define insw insw 240 + #define insl insl 241 + #define outsb outsb 242 + #define outsw outsw 243 + #define outsl outsl 248 244 249 245 #define IO_SPACE_LIMIT 0xffffffff 250 246 251 247 /* We really want to try and get these to memcpy etc */ 248 + #define memset_io memset_io 249 + #define memcpy_fromio memcpy_fromio 250 + #define memcpy_toio memcpy_toio 252 251 void memcpy_fromio(void *, const volatile void __iomem *, unsigned long); 253 252 void memcpy_toio(volatile void __iomem *, const void *, unsigned long); 254 253 void memset_io(volatile void __iomem *, int, unsigned long); ··· 334 287 */ 335 288 #define xlate_dev_mem_ptr(p) __va(p) 336 289 #define unxlate_dev_mem_ptr(p, v) do { } while (0) 290 + 291 + #include <asm-generic/io.h> 337 292 338 293 #define ARCH_HAS_VALID_PHYS_ADDR_RANGE 339 294 int valid_phys_addr_range(phys_addr_t addr, size_t size);
-7
arch/sh/include/asm/io_noioport.h
··· 46 46 BUG(); 47 47 } 48 48 49 - #define inb_p(addr) inb(addr) 50 - #define inw_p(addr) inw(addr) 51 - #define inl_p(addr) inl(addr) 52 - #define outb_p(x, addr) outb((x), (addr)) 53 - #define outw_p(x, addr) outw((x), (addr)) 54 - #define outl_p(x, addr) outl((x), (addr)) 55 - 56 49 static inline void insb(unsigned long port, void *dst, unsigned long count) 57 50 { 58 51 BUG();