Re: [PATCH v2 1/2] mips: add <asm-generic/io.h> including

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/01/23 at 03:06pm, Arnd Bergmann wrote:
> On Wed, Mar 1, 2023, at 11:22, Baoquan He wrote:
> > With the adding, some default ioremap_xx methods defined in
> > asm-generic/io.h can be used. E.g the default ioremap_uc() returning
> > NULL.
> >
> > Here, remove the <asm/io.h> including in asm/mmiowb.h, otherwise nested
> > including will cause compiling error.
> >
> > Signed-off-by: Baoquan He <bhe@xxxxxxxxxx>
> > Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>
> > Cc: Huacai Chen <chenhuacai@xxxxxxxxxx>
> > Cc: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>
> > Cc: linux-mips@xxxxxxxxxxxxxxx
> 
> This looks good to me,
> 
> Reviewed-by: Arnd Bergmann <arnd@xxxxxxxx>
> 
> but it obviously needs to be properly reviewed by the MIPS
> maintainers as well. I think others have tried to do this
> in the past but did not make it in.

Thanks for reviewing. Then let's wait for MIPS people to help check
this.

> 
> > @@ -548,6 +552,46 @@ extern void (*_dma_cache_inv)(unsigned long start, 
> > unsigned long size);
> >  #define csr_out32(v, a) (*(volatile u32 *)((unsigned long)(a) + 
> > __CSR_32_ADJUST) = (v))
> >  #define csr_in32(a)    (*(volatile u32 *)((unsigned long)(a) + 
> > __CSR_32_ADJUST))
> > 
> > +
> > +#define inb_p inb_p
> > +#define inw_p inw_p
> > +#define inl_p inl_p
> > +#define insb insb
> > +#define insw insw
> > +#define insl insl
> 
> I would prefer to put the #defines next to the function declarations,
> even when they come from macros.

Yeah, sounds reasonable, will change.

> 
> > 
> > -#include <asm/io.h>
> > -
> >  #define mmiowb()	iobarrier_w()
> > 
> 
> I think this only works as long as asm/spinlock.h also includes
> asm/io.h, otherwise linux/spinlock.h will be missing the
> iobarrier_w definition.
> 
> Most likely this is implicitly included from somewhere else
> below linux/spinlock.h, but it would be better not to rely
> on that, and instead define mmiowb() to wmb() directly.

Yeah, defining mmiowb() to wmb() directly is also good to me. I tried
to comb including sequence and find where asm/io.h is included, but
failed. Mainly asm/mmiowb.h including asm/io.h will cause below
compiling error, the asm/io.h need see mmiowb_set_pending which is
defnined in asm-generic/mmiowb.h. Moving asm-generic/mmiowb.h to above
asm/io.h can also fix the compiling error.

=============
diff --git a/arch/mips/include/asm/mmiowb.h b/arch/mips/include/asm/mmiowb.h
index a40824e3ef8e..cae2745935bc 100644
--- a/arch/mips/include/asm/mmiowb.h
+++ b/arch/mips/include/asm/mmiowb.h
@@ -2,10 +2,8 @@
 #ifndef _ASM_MMIOWB_H
 #define _ASM_MMIOWB_H
 
+#include <asm-generic/mmiowb.h>
 #include <asm/io.h>
 
 #define mmiowb()       iobarrier_w()
-
-#include <asm-generic/mmiowb.h>
-
 #endif /* _ASM_MMIOWB_H */


============
  CC      arch/mips/kernel/asm-offsets.s
In file included from ./arch/mips/include/asm/io.h:602,
                 from ./arch/mips/include/asm/mmiowb.h:6,
                 from ./include/linux/spinlock.h:65,
                 from ./include/linux/ipc.h:5,
                 from ./include/uapi/linux/sem.h:5,
                 from ./include/linux/sem.h:5,
                 from ./include/linux/compat.h:14,
                 from arch/mips/kernel/asm-offsets.c:12:
./include/asm-generic/io.h: In function ‘_outb’:
./include/asm-generic/io.h:46:24: error: implicit declaration of function ‘mmiowb_set_pending’ [-Werror=implicit-function-declaration]
   46 | #define __io_aw()      mmiowb_set_pending()
      |                        ^~~~~~~~~~~~~~~~~~
./include/asm-generic/io.h:54:24: note: in expansion of macro ‘__io_aw’
   54 | #define __io_paw()     __io_aw()
      |                        ^~~~~~~
./include/asm-generic/io.h:585:9: note: in expansion of macro ‘__io_paw’
  585 |         __io_paw();
      |         ^~~~~~~~





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux