Linux-sh Archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Rich Felker <dalias@libc.org>,
	John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
	Baoquan He <bhe@redhat.com>, Guenter Roeck <linux@roeck-us.net>,
	linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] sh: fix asm-generic/io.h inclusion
Date: Wed,  2 Aug 2023 16:16:41 +0200	[thread overview]
Message-ID: <20230802141658.2064864-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

A recent cleanup patch started using the generic asm/io.h header from
the sh version, but unfortunately this caused build regressions in many
configurations, such as:

include/asm-generic/io.h:636:15: error: redefinition of ‘inb_p’

I added some of the missing defines that are needed to keep using the
sh specific implementations rather than the generic ones where they
clash. I build all sh defconfig files to catch the various combinations
of CONFIG_MMU, CONFIG_GENERIC_IOMAP and CONFIG_NO_IOPORT_MAP, this should
cover them all.

A lot of the sh specific functions are equivalent to the generic ones
and could in fact be removed, but it would be best to only do that with
actual runtime testing.

In particular, the indirect ioport_map() implementation is only used
for the "microdev" platform that appears to be broken beyond repair
for as long as the git history goes, so removing both microdev and the
custom ioport handling in favor of the asm-generic/io.h version would
be a great cleanup, but this can be done another time if anyone feels
motivated to clean up arch/sh.

Fixes: e41f1f7ff6c2b ("sh: add <asm-generic/io.h> including")
Link: https://lore.kernel.org/lkml/09094baf-dadf-4bce-9f63-f2a1f255f9a8@app.fastmail.com/
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
Andrew, can you pick this up into the mm tree on top of the
"sh: add <asm-generic/io.h> including" patch?
---
 arch/sh/include/asm/io.h          | 24 ++++++++++++++++++++++++
 arch/sh/include/asm/io_noioport.h | 14 --------------
 2 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 24c560c065ec7..f2f38e9d489ac 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -119,6 +119,10 @@ void __raw_readsl(const void __iomem *addr, void *data, int longlen);
 
 __BUILD_MEMORY_STRING(__raw_, q, u64)
 
+#define ioport_map ioport_map
+#define ioport_unmap ioport_unmap
+#define pci_iounmap pci_iounmap
+
 #define ioread8 ioread8
 #define ioread16 ioread16
 #define ioread16be ioread16be
@@ -241,6 +245,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();
-- 
2.39.2


             reply	other threads:[~2023-08-02 14:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02 14:16 Arnd Bergmann [this message]
2023-08-02 15:57 ` [PATCH] sh: fix asm-generic/io.h inclusion Guenter Roeck
2023-08-02 17:30 ` John Paul Adrian Glaubitz
2023-08-02 23:38 ` Baoquan He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230802141658.2064864-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=bhe@redhat.com \
    --cc=dalias@libc.org \
    --cc=geert@linux-m68k.org \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=ysato@users.sourceforge.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).