2016-01-15 17:51+0100, Andrew Jones: > Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx> > --- > diff --git a/lib/asm-generic/io.h b/lib/asm-generic/io.h > @@ -152,6 +152,58 @@ static inline u64 __bswap64(u64 x) > +#ifndef PCI_IOBASE > +#define PCI_IOBASE ((void *)0) > +#endif > + > +#ifndef inb > +#define inb inb (I consider this repeated pattern to be very ugly, even by C standards.) > +static inline u8 inb(unsigned long addr) > +{ > + return readb(PCI_IOBASE + addr); > +} My first reaction was "throw this abomination out!", but Drew explained that in*/out* is here because we'll also generalize the x86 PCI code (which uses PIO and MMIO) and that Linux has the same code. arm, arm64, and unicore32 define PCI_IOBASE in Linux. I didn't figure out why they want to use a PIO based abstraction for MMIO, so the interface is fine with me as long as - functions are hidden behind a single #ifndef, like ARCH_HAS_PORT_IO. (Ideally defined as part of global configuration, because it's harder to fail that way.) - "unsigned long addr" is changed to "u16 port"; x86 ought to have that and we should use different names if we need different types, because behavior couldn't be the same then. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html