Re: [PATCH] parisc: Use the generic IO helpers

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

 



On Wed, Aug 31, 2022, at 11:44 PM, Linus Walleij wrote:
> @@ -135,35 +135,43 @@ static inline unsigned char __raw_readb(const 
> volatile void __iomem *addr)
>  {
>  	return (*(volatile unsigned char __force *) (addr));
>  }
> +#define __raw_readb __raw_readb
>  static inline unsigned short __raw_readw(const volatile void __iomem 
> *addr)
>  {
>  	return *(volatile unsigned short __force *) addr;
>  }
> +#define __raw_readw __raw_readw

These are the same as the asm-generic version, so it might
be nice to just use those and remove the duplicates.

The readl() etc wrappers around them are more complicated in
the generic version, and may require to #define the
__io_ar()/__io_bw(() etc to nothing to avoid adding extra
barriers. Not sure if we want to go so far, or if parisc
is actually correct here: Most RISC architectures do need
barriers between a readl/writel and a corresponding DMA,
so pa-risc would be an exception here for not needing
them.

>  #include <asm-generic/iomap.h>
> +/* These get provided from <asm-generic/iomap.h> */
> +#define ioport_map ioport_map
> +#define ioport_unmap ioport_unmap
> +#define ioread8 ioread8
> +#define ioread16 ioread16
> +#define ioread32 ioread32
> +#define ioread16be ioread16be
> +#define ioread32be ioread32be
> +#define iowrite8 iowrite8
> +#define iowrite16 iowrite16
> +#define iowrite32 iowrite32
> +#define iowrite16be iowrite16be
> +#define iowrite32be iowrite32be
> +#define ioread8_rep ioread8_rep
> +#define ioread16_rep ioread16_rep
> +#define ioread32_rep ioread32_rep
> +#define iowrite8_rep iowrite8_rep
> +#define iowrite16_rep iowrite16_rep
> +#define iowrite32_rep iowrite32_rep

You should not need these overrides here, since the
definitions in asm-generic/io.h are only relevant
for the !CONFIG_GENERIC_IOMAP case, i.e. architectures
that can access port I/O through MMIO rather than
special helper functions or instructions.

Somewhat unrelated to your series, I suppose it would be
great if we could move the "#include <asm-generic/iomap.h>"
to include/asm-generic/io.h itself for the
CONFIG_GENERIC_IOMAP case. Hopefully each architecture
uses one case or the other.

      Arnd



[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux