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

From: Baoquan He
Date: Mon Mar 06 2023 - 03:47:42 EST


On 03/03/23 at 01:40pm, Arnd Bergmann wrote:
> On Fri, Mar 3, 2023, at 11:28, 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.
> >
> > Signed-off-by: Baoquan He <bhe@xxxxxxxxxx>
> > Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>
> > Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> > Cc: Helge Deller <deller@xxxxxx>
> > Cc: Serge Semin <fancer.lancer@xxxxxxxxx>
> > Cc: Florian Fainelli <f.fainelli@xxxxxxxxx>
> > Cc: Huacai Chen <chenhuacai@xxxxxxxxxx>
> > Cc: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>
> > Cc: linux-mips@xxxxxxxxxxxxxxx
>
> Reviewed-by: Arnd Bergmann <arnd@xxxxxxxx>
>
> I think this is all good. I had look at what cleanups we could do as
> follow-ups:

Thanks a lot for careful reviewing and great suggestions.

>
> > +#define phys_to_virt phys_to_virt
> > static inline void * phys_to_virt(unsigned long address)
> > {
> > return __va(address);
>
> This is the same as the asm-generic version, so the mips definition
> is no longer needed.

Agree, I can clean this up with a followup patch.

>
> > @@ -359,6 +360,27 @@ __BUILD_MEMORY_PFX(__raw_, q, u64, 0)
> > __BUILD_MEMORY_PFX(__mem_, q, u64, 0)
> > #endif
> >
> > +#define readb readb
> > +#define readw readw
> > +#define readl readl
> > +#define writeb writeb
> > +#define writew writew
> > +#define writel writel
> > +
> > +#ifdef CONFIG_64BIT
> > +#define readq readq
> > +#define writeq writeq
> > +#define __raw_readq __raw_readq
> > +#define __raw_writeq __raw_writeq
> > +#endif
> > +
> > +#define __raw_readb __raw_readb
> > +#define __raw_readw __raw_readw
> > +#define __raw_readl __raw_readl
> > +#define __raw_writeb __raw_writeb
> > +#define __raw_writew __raw_writew
> > +#define __raw_writel __raw_writel
>
> The mips code defines the __raw variants with slightly different
> semantics on both barriers and byteswap, which makes it impractical
> to share any of the above.
>
> > +#define memset_io memset_io
> > static inline void memset_io(volatile void __iomem *addr, unsigned
> > char val, int count)
> > {
> > memset((void __force *) addr, val, count);
> > }
> > +#define memcpy_fromio memcpy_fromio
> > static inline void memcpy_fromio(void *dst, const volatile void
> > __iomem *src, int count)
> > {
> > memcpy(dst, (void __force *) src, count);
> > }
> > +#define memcpy_toio memcpy_toio
>
> These are again the same as the generic version

OK, can remove this with the above change.