linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org, linux-mm@kvack.org, arnd@arndb.de,
	christophe.leroy@csgroup.eu, hch@infradead.org,
	agordeev@linux.ibm.com, wangkefeng.wang@huawei.com,
	schnelle@linux.ibm.com, David.Laight@ACULAB.COM,
	shorne@gmail.com, willy@infradead.org, deller@gmx.de,
	Baoquan He <bhe@redhat.com>,
	loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org,
	linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	x86@kernel.org, netdev@vger.kernel.org
Subject: [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros
Date: Mon, 15 May 2023 17:08:32 +0800	[thread overview]
Message-ID: <20230515090848.833045-2-bhe@redhat.com> (raw)
In-Reply-To: <20230515090848.833045-1-bhe@redhat.com>

Let's use '#define ioremap_xx' and "#ifdef ioremap_xx" instead.

For each architecture to remove defined ARCH_HAS_IOREMAP_xx macros in
To remove defined ARCH_HAS_IOREMAP_xx macros in <asm/io.h> of each ARCH,
the ARCH's own ioremap_wc|wt|np definition need be above
"#include <asm-generic/iomap.h>. Otherwise the redefinition error would
be seen during compiling. So the relevant adjustments are made to avoid
compiling error:

  loongarch:
  - doesn't include <asm-generic/iomap.h>, defining ARCH_HAS_IOREMAP_WC
    is redundant, so simply remove it.

  m68k:
  - selected GENERIC_IOMAP, <asm-generic/iomap.h> has been added in
    <asm-generic/io.h>, and <asm/kmap.h> is included above
    <asm-generic/iomap.h>, so simply remove ARCH_HAS_IOREMAP_WT defining.

  mips:
  - move "#include <asm-generic/iomap.h>" below ioremap_wc definition
    in <asm/io.h>

  powerpc:
  - remove "#include <asm-generic/iomap.h>" in <asm/io.h> because it's
    duplicated with the one in <asm-generic/io.h>, let's rely on the
    latter.

  x86:
  - selected GENERIC_IOMAP, remove #include <asm-generic/iomap.h> in
    the middle of <asm/io.h>. Let's rely on <asm-generic/io.h>.

Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: loongarch@lists.linux.dev
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-mips@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: x86@kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-arch@vger.kernel.org
---
 arch/loongarch/include/asm/io.h     | 2 --
 arch/m68k/include/asm/io_mm.h       | 2 --
 arch/m68k/include/asm/kmap.h        | 2 --
 arch/mips/include/asm/io.h          | 5 ++---
 arch/powerpc/include/asm/io.h       | 9 +--------
 arch/x86/include/asm/io.h           | 5 -----
 drivers/net/ethernet/sfc/io.h       | 2 +-
 drivers/net/ethernet/sfc/siena/io.h | 2 +-
 include/asm-generic/iomap.h         | 6 +++---
 9 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/arch/loongarch/include/asm/io.h b/arch/loongarch/include/asm/io.h
index 545e2708fbf7..5fef1246c6fb 100644
--- a/arch/loongarch/include/asm/io.h
+++ b/arch/loongarch/include/asm/io.h
@@ -5,8 +5,6 @@
 #ifndef _ASM_IO_H
 #define _ASM_IO_H
 
-#define ARCH_HAS_IOREMAP_WC
-
 #include <linux/kernel.h>
 #include <linux/types.h>
 
diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
index d41fa488453b..6a0abd4846c6 100644
--- a/arch/m68k/include/asm/io_mm.h
+++ b/arch/m68k/include/asm/io_mm.h
@@ -26,8 +26,6 @@
 #include <asm/virtconvert.h>
 #include <asm/kmap.h>
 
-#include <asm-generic/iomap.h>
-
 #ifdef CONFIG_ATARI
 #define atari_readb   raw_inb
 #define atari_writeb  raw_outb
diff --git a/arch/m68k/include/asm/kmap.h b/arch/m68k/include/asm/kmap.h
index dec05743d426..4efb3efa593a 100644
--- a/arch/m68k/include/asm/kmap.h
+++ b/arch/m68k/include/asm/kmap.h
@@ -4,8 +4,6 @@
 
 #ifdef CONFIG_MMU
 
-#define ARCH_HAS_IOREMAP_WT
-
 /* Values for nocacheflag and cmode */
 #define IOMAP_FULL_CACHING		0
 #define IOMAP_NOCACHE_SER		1
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index cc28d207a061..477773328a06 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -12,8 +12,6 @@
 #ifndef _ASM_IO_H
 #define _ASM_IO_H
 
-#define ARCH_HAS_IOREMAP_WC
-
 #include <linux/compiler.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
@@ -25,7 +23,6 @@
 #include <asm/byteorder.h>
 #include <asm/cpu.h>
 #include <asm/cpu-features.h>
-#include <asm-generic/iomap.h>
 #include <asm/page.h>
 #include <asm/pgtable-bits.h>
 #include <asm/processor.h>
@@ -210,6 +207,8 @@ void iounmap(const volatile void __iomem *addr);
 #define ioremap_wc(offset, size)					\
 	ioremap_prot((offset), (size), boot_cpu_data.writecombine)
 
+#include <asm-generic/iomap.h>
+
 #if defined(CONFIG_CPU_CAVIUM_OCTEON)
 #define war_io_reorder_wmb()		wmb()
 #else
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index f1e657c9bbe8..67a3fb6de498 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -3,11 +3,6 @@
 #define _ASM_POWERPC_IO_H
 #ifdef __KERNEL__
 
-#define ARCH_HAS_IOREMAP_WC
-#ifdef CONFIG_PPC32
-#define ARCH_HAS_IOREMAP_WT
-#endif
-
 /*
  */
 
@@ -732,9 +727,7 @@ static inline void name at					\
 #define writel_relaxed(v, addr)	writel(v, addr)
 #define writeq_relaxed(v, addr)	writeq(v, addr)
 
-#ifdef CONFIG_GENERIC_IOMAP
-#include <asm-generic/iomap.h>
-#else
+#ifndef CONFIG_GENERIC_IOMAP
 /*
  * Here comes the implementation of the IOMAP interfaces.
  */
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index e9025640f634..76238842406a 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -35,9 +35,6 @@
   *  - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
   */
 
-#define ARCH_HAS_IOREMAP_WC
-#define ARCH_HAS_IOREMAP_WT
-
 #include <linux/string.h>
 #include <linux/compiler.h>
 #include <linux/cc_platform.h>
@@ -212,8 +209,6 @@ void memset_io(volatile void __iomem *, int, size_t);
 #define memcpy_toio memcpy_toio
 #define memset_io memset_io
 
-#include <asm-generic/iomap.h>
-
 /*
  * ISA space is 'always mapped' on a typical x86 system, no need to
  * explicitly ioremap() it. The fact that the ISA IO space is mapped
diff --git a/drivers/net/ethernet/sfc/io.h b/drivers/net/ethernet/sfc/io.h
index 30439cc83a89..07f99ad14bf3 100644
--- a/drivers/net/ethernet/sfc/io.h
+++ b/drivers/net/ethernet/sfc/io.h
@@ -70,7 +70,7 @@
  */
 #ifdef CONFIG_X86_64
 /* PIO is a win only if write-combining is possible */
-#ifdef ARCH_HAS_IOREMAP_WC
+#ifdef ioremap_wc
 #define EFX_USE_PIO 1
 #endif
 #endif
diff --git a/drivers/net/ethernet/sfc/siena/io.h b/drivers/net/ethernet/sfc/siena/io.h
index 30439cc83a89..07f99ad14bf3 100644
--- a/drivers/net/ethernet/sfc/siena/io.h
+++ b/drivers/net/ethernet/sfc/siena/io.h
@@ -70,7 +70,7 @@
  */
 #ifdef CONFIG_X86_64
 /* PIO is a win only if write-combining is possible */
-#ifdef ARCH_HAS_IOREMAP_WC
+#ifdef ioremap_wc
 #define EFX_USE_PIO 1
 #endif
 #endif
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
index 08237ae8b840..196087a8126e 100644
--- a/include/asm-generic/iomap.h
+++ b/include/asm-generic/iomap.h
@@ -93,15 +93,15 @@ extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
 extern void ioport_unmap(void __iomem *);
 #endif
 
-#ifndef ARCH_HAS_IOREMAP_WC
+#ifndef ioremap_wc
 #define ioremap_wc ioremap
 #endif
 
-#ifndef ARCH_HAS_IOREMAP_WT
+#ifndef ioremap_wt
 #define ioremap_wt ioremap
 #endif
 
-#ifndef ARCH_HAS_IOREMAP_NP
+#ifndef ioremap_np
 /* See the comment in asm-generic/io.h about ioremap_np(). */
 #define ioremap_np ioremap_np
 static inline void __iomem *ioremap_np(phys_addr_t offset, size_t size)
-- 
2.34.1


  reply	other threads:[~2023-05-15  9:10 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-15  9:08 [PATCH v5 RESEND 00/17] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
2023-05-15  9:08 ` Baoquan He [this message]
2023-05-16  6:15   ` [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros Mike Rapoport
2023-05-16 12:54     ` Baoquan He
2023-05-16  7:07   ` Geert Uytterhoeven
2023-05-17  6:27   ` Christoph Hellwig
2023-05-15  9:08 ` [PATCH v5 RESEND 02/17] hexagon: mm: Convert to GENERIC_IOREMAP Baoquan He
2023-05-16  6:17   ` Mike Rapoport
2023-05-17  6:27   ` Christoph Hellwig
2023-05-15  9:08 ` [PATCH v5 RESEND 03/17] openrisc: mm: remove unneeded early ioremap code Baoquan He
2023-05-16  6:17   ` Mike Rapoport
2023-05-16 13:03     ` Baoquan He
2023-05-17  6:28   ` Christoph Hellwig
2023-05-15  9:08 ` [PATCH v5 RESEND 04/17] mm/ioremap: Define generic_ioremap_prot() and generic_iounmap() Baoquan He
2023-05-16  6:17   ` Mike Rapoport
2023-05-17  6:29   ` Christoph Hellwig
2023-05-18  3:38     ` Baoquan He
2023-05-18  1:56   ` Kefeng Wang
2023-05-15  9:08 ` [PATCH v5 RESEND 05/17] mm: ioremap: allow ARCH to have its own ioremap method definition Baoquan He
2023-05-16  6:48   ` Mike Rapoport
2023-05-17  6:30   ` Christoph Hellwig
2023-05-18  1:56   ` Kefeng Wang
2023-05-15  9:08 ` [PATCH v5 RESEND 06/17] mm/ioremap: add slab availability checking in ioremap_prot Baoquan He
2023-05-16  6:48   ` Mike Rapoport
2023-05-17  6:30   ` Christoph Hellwig
2023-05-18  3:43     ` Baoquan He
2023-05-18  1:57   ` Kefeng Wang
2023-05-15  9:08 ` [PATCH v5 RESEND 07/17] arc: mm: Convert to GENERIC_IOREMAP Baoquan He
2023-05-16  6:49   ` Mike Rapoport
2023-05-17  6:31   ` Christoph Hellwig
2023-05-18  3:43     ` Baoquan He
2023-05-30  9:25     ` Baoquan He
2023-06-01 11:14       ` Christoph Hellwig
2023-05-15  9:08 ` [PATCH v5 RESEND 08/17] ia64: " Baoquan He
2023-05-16  6:49   ` Mike Rapoport
2023-05-17  6:33   ` Christoph Hellwig
2023-05-18  3:44     ` Baoquan He
2023-05-15  9:08 ` [PATCH v5 RESEND 09/17] openrisc: " Baoquan He
2023-05-16  6:49   ` Mike Rapoport
2023-05-16 13:05     ` Baoquan He
2023-05-15  9:08 ` [PATCH v5 RESEND 10/17] s390: " Baoquan He
2023-05-16  6:50   ` Mike Rapoport
2023-05-17  6:36   ` Christoph Hellwig
2023-05-17  7:58     ` Niklas Schnelle
2023-05-17  8:08       ` Christoph Hellwig
2023-05-15  9:08 ` [PATCH v5 RESEND 11/17] sh: " Baoquan He
2023-05-17  6:37   ` Christoph Hellwig
2023-05-18  3:45     ` Baoquan He
2023-05-15  9:08 ` [PATCH v5 RESEND 12/17] xtensa: " Baoquan He
2023-05-16  6:51   ` Mike Rapoport
2023-05-17  6:38   ` Christoph Hellwig
2023-05-15  9:08 ` [PATCH v5 RESEND 13/17] parisc: " Baoquan He
2023-05-16  6:52   ` Mike Rapoport
2023-05-16 13:07     ` Baoquan He
2023-05-17  6:38   ` Christoph Hellwig
2023-05-15  9:08 ` [PATCH v5 RESEND 14/17] mm/ioremap: Consider IOREMAP space in generic ioremap Baoquan He
2023-05-16  6:53   ` Mike Rapoport
2023-05-17  6:41   ` Christoph Hellwig
2023-05-17  6:44     ` Christoph Hellwig
2023-05-20  3:31       ` Baoquan He
2023-05-20  5:04         ` Christoph Hellwig
2023-05-30  9:37       ` Baoquan He
2023-06-01 11:13         ` Christoph Hellwig
2023-06-02 10:42           ` Baoquan He
2023-06-02 15:05             ` Christoph Hellwig
2023-05-20  3:28     ` Baoquan He
2023-05-15  9:08 ` [PATCH v5 RESEND 15/17] powerpc: mm: Convert to GENERIC_IOREMAP Baoquan He
2023-05-16  7:00   ` Mike Rapoport
2023-05-17  6:42   ` Christoph Hellwig
2023-05-15  9:08 ` [PATCH v5 RESEND 16/17] arm64 : mm: add wrapper function ioremap_prot() Baoquan He
2023-05-16  7:02   ` Mike Rapoport
2023-05-17  6:42   ` Christoph Hellwig
2023-05-18  1:58   ` Kefeng Wang
2023-05-15  9:08 ` [PATCH v5 RESEND 17/17] mm: ioremap: remove unneeded ioremap_allowed and iounmap_allowed Baoquan He
2023-05-16  7:02   ` Mike Rapoport
2023-05-17  6:43   ` Christoph Hellwig
2023-05-18  1:58   ` Kefeng Wang

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=20230515090848.833045-2-bhe@redhat.com \
    --to=bhe@redhat.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=agordeev@linux.ibm.com \
    --cc=arnd@arndb.de \
    --cc=christophe.leroy@csgroup.eu \
    --cc=deller@gmx.de \
    --cc=hch@infradead.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=loongarch@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=schnelle@linux.ibm.com \
    --cc=shorne@gmail.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.org \
    --cc=x86@kernel.org \
    /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 NNTP newsgroup(s).