Re: [PATCH 05/27] asm-generic: add generic io.h

From: Arnd Bergmann
Date: Mon May 04 2009 - 06:48:59 EST


io.h is more or less a straight copy from the mn10300 code,
so maybe David Howells is interested in this as well.

On Monday 04 May 2009, Geert Uytterhoeven wrote:
> On Thu, Nov 6, 2008 at 15:38, Arnd Bergmann <arnd@xxxxxxxx> wrote:
> > +static inline void outsw(unsigned long addr, const void *buffer, int count)
> > +{
> > + Â Â Â if (count) {
> > + Â Â Â Â Â Â Â const u16 *buf = buffer;
> > + Â Â Â Â Â Â Â do {
> > + Â Â Â Â Â Â Â Â Â Â Â outw(*buf++, addr);
> > + Â Â Â Â Â Â Â } while (--count);
> > + Â Â Â }
> > +}
> > +
> > +static inline void outsl(unsigned long addr, const void *buffer, int count)
> > +{
> > + Â Â Â if (count) {
> > + Â Â Â Â Â Â Â const u32 *buf = buffer;
> > + Â Â Â Â Â Â Â do {
> > + Â Â Â Â Â Â Â Â Â Â Â outl(*buf++, addr);
> > + Â Â Â Â Â Â Â } while (--count);
> > + Â Â Â }
> > +}
>
> Do we ever call these with count == 0?

I don't think it can, but code is still more correct if it can handle it.
It could of course be written as

const u32 *buf;
for (buf = buffer; count; count--)
outl(*buf++, addr);


> > +/*
> > + * Change "struct page" to physical address.
> > + */
>
> Which `struct page'?

I can change the comment to what avr32 and m32r have:

arch/avr32/include/asm/io.h-/*
arch/avr32/include/asm/io.h: * ioremap - map bus memory into CPU space
arch/avr32/include/asm/io.h- * @offset bus address of the memory
arch/avr32/include/asm/io.h- * @size size of the resource to map
arch/avr32/include/asm/io.h- *
arch/avr32/include/asm/io.h: * ioremap performs a platform specific sequence of operations to make
arch/avr32/include/asm/io.h- * bus memory CPU accessible via the readb/.../writel functions and
arch/avr32/include/asm/io.h- * the other mmio helpers. The returned address is not guaranteed to
arch/avr32/include/asm/io.h- * be usable directly as a virtual address.
arch/avr32/include/asm/io.h- */


Arnd <><
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/