Re: [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros

2023-05-16 Thread Christoph Hellwig
Looks good:

Reviewed-by: Christoph Hellwig 


Re: [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros

2023-05-16 Thread Baoquan He
On 05/16/23 at 09:15am, Mike Rapoport wrote:
> Hi,
> 
> On Mon, May 15, 2023 at 05:08:32PM +0800, Baoquan He wrote:
> > Let's use '#define ioremap_xx' and "#ifdef ioremap_xx" instead.
> > 
> > For each architecture to remove defined ARCH_HAS_IOREMAP_xx macros in
> 
> This sentence seems to be stale.

Right, will remove this, thanks a lot for careful reviewing.

> 
> > To remove defined ARCH_HAS_IOREMAP_xx macros in  of each ARCH,
> > the ARCH's own ioremap_wc|wt|np definition need be above
> > "#include . Otherwise the redefinition error would
> > be seen during compiling. So the relevant adjustments are made to avoid
> > compiling error:
> > 
> >   loongarch:
> >   - doesn't include , defining ARCH_HAS_IOREMAP_WC
> > is redundant, so simply remove it.
> > 
> >   m68k:
> >   - selected GENERIC_IOMAP,  has been added in
> > , and  is included above
> > , so simply remove ARCH_HAS_IOREMAP_WT defining.
> > 
> >   mips:
> >   - move "#include " below ioremap_wc definition
> > in 
> > 
> >   powerpc:
> >   - remove "#include " in  because it's
> > duplicated with the one in , let's rely on the
> > latter.
> > 
> >   x86:
> >   - selected GENERIC_IOMAP, remove #include  in
> > the middle of . Let's rely on .
> > 
> > Signed-off-by: Baoquan He 
> > Cc: loonga...@lists.linux.dev
> > Cc: linux-m...@lists.linux-m68k.org
> > Cc: linux-m...@vger.kernel.org
> > Cc: linuxppc-dev@lists.ozlabs.org
> > Cc: x...@kernel.org
> > Cc: net...@vger.kernel.org
> > Cc: linux-a...@vger.kernel.org
> 
> Reviewed-by: Mike Rapoport (IBM) 
> 
> > ---
> >  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 
> >  #include 
> >  
> > 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 
> >  #include 
> >  
> > -#include 
> > -
> >  #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..43328a06 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 
> >  #include 
> >  #include 
> > @@ -25,7 +23,6 @@
> >  #include 
> >  #include 
> >  #include 
> > -#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -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 
> > +
> >  #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 
> > -#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/arc

Re: [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros

2023-05-16 Thread Geert Uytterhoeven
On Mon, May 15, 2023 at 11:14 AM Baoquan He  wrote:
> 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  of each ARCH,
> the ARCH's own ioremap_wc|wt|np definition need be above
> "#include . Otherwise the redefinition error would
> be seen during compiling. So the relevant adjustments are made to avoid
> compiling error:
>
>   loongarch:
>   - doesn't include , defining ARCH_HAS_IOREMAP_WC
> is redundant, so simply remove it.
>
>   m68k:
>   - selected GENERIC_IOMAP,  has been added in
> , and  is included above
> , so simply remove ARCH_HAS_IOREMAP_WT defining.
>
>   mips:
>   - move "#include " below ioremap_wc definition
> in 
>
>   powerpc:
>   - remove "#include " in  because it's
> duplicated with the one in , let's rely on the
> latter.
>
>   x86:
>   - selected GENERIC_IOMAP, remove #include  in
> the middle of . Let's rely on .
>
> Signed-off-by: Baoquan He 

>  arch/m68k/include/asm/io_mm.h   | 2 --
>  arch/m68k/include/asm/kmap.h| 2 --

Acked-by: Geert Uytterhoeven 

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros

2023-05-15 Thread Mike Rapoport
Hi,

On Mon, May 15, 2023 at 05:08:32PM +0800, Baoquan He wrote:
> Let's use '#define ioremap_xx' and "#ifdef ioremap_xx" instead.
> 
> For each architecture to remove defined ARCH_HAS_IOREMAP_xx macros in

This sentence seems to be stale.

> To remove defined ARCH_HAS_IOREMAP_xx macros in  of each ARCH,
> the ARCH's own ioremap_wc|wt|np definition need be above
> "#include . Otherwise the redefinition error would
> be seen during compiling. So the relevant adjustments are made to avoid
> compiling error:
> 
>   loongarch:
>   - doesn't include , defining ARCH_HAS_IOREMAP_WC
> is redundant, so simply remove it.
> 
>   m68k:
>   - selected GENERIC_IOMAP,  has been added in
> , and  is included above
> , so simply remove ARCH_HAS_IOREMAP_WT defining.
> 
>   mips:
>   - move "#include " below ioremap_wc definition
> in 
> 
>   powerpc:
>   - remove "#include " in  because it's
> duplicated with the one in , let's rely on the
> latter.
> 
>   x86:
>   - selected GENERIC_IOMAP, remove #include  in
> the middle of . Let's rely on .
> 
> Signed-off-by: Baoquan He 
> Cc: loonga...@lists.linux.dev
> Cc: linux-m...@lists.linux-m68k.org
> Cc: linux-m...@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: x...@kernel.org
> Cc: net...@vger.kernel.org
> Cc: linux-a...@vger.kernel.org

Reviewed-by: Mike Rapoport (IBM) 

> ---
>  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 
>  #include 
>  
> 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 
>  #include 
>  
> -#include 
> -
>  #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_SER1
> diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
> index cc28d207a061..43328a06 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 
>  #include 
>  #include 
> @@ -25,7 +23,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -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 
> +
>  #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 
> -#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 
>*/
>  
> -#define ARCH_HAS_IOREMAP_WC
> -#define ARCH_HAS_IOREMAP_WT
> -
>  #include 
>  #include 
>  #include 
> @@ -212,8 +209,6 @@ void memset_io(volatile void __iomem *, int, size_t);
>  #define memcpy_toio memcpy_toio
>  #define memset_io memset_io
>  
> -#include 
> -
>  /*
>   * ISA space is 'always

[PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros

2023-05-15 Thread Baoquan He
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  of each ARCH,
the ARCH's own ioremap_wc|wt|np definition need be above
"#include . Otherwise the redefinition error would
be seen during compiling. So the relevant adjustments are made to avoid
compiling error:

  loongarch:
  - doesn't include , defining ARCH_HAS_IOREMAP_WC
is redundant, so simply remove it.

  m68k:
  - selected GENERIC_IOMAP,  has been added in
, and  is included above
, so simply remove ARCH_HAS_IOREMAP_WT defining.

  mips:
  - move "#include " below ioremap_wc definition
in 

  powerpc:
  - remove "#include " in  because it's
duplicated with the one in , let's rely on the
latter.

  x86:
  - selected GENERIC_IOMAP, remove #include  in
the middle of . Let's rely on .

Signed-off-by: Baoquan He 
Cc: loonga...@lists.linux.dev
Cc: linux-m...@lists.linux-m68k.org
Cc: linux-m...@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: x...@kernel.org
Cc: net...@vger.kernel.org
Cc: linux-a...@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 
 #include 
 
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 
 #include 
 
-#include 
-
 #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..43328a06 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 
 #include 
 #include 
@@ -25,7 +23,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -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 
+
 #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 
-#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 
   */
 
-#define ARCH_HAS_IOREMAP_WC
-#define ARCH_HAS_IOREMAP_WT
-
 #include 
 #include 
 #include 
@@ -212,8 +209,6 @@ void memset_io(volatile void __iomem *, int, size_t);
 #define memcpy_toio memcpy_toio
 #define memset_io memset_io
 
-#include 
-
 /*
  * 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_P