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

Geert Uytterhoeven
2009-05-04T07:07:25Z

On Thu, Nov 6, 2008 at 15:38, Arnd Bergmann <arnd@arndb.de> wrote:
> --- /dev/null
> +++ b/include/asm-generic/io.h

> +static inline void insb(unsigned long addr, void *buffer, int count)
> +{
> +       if (count) {
> +               u8 *buf = buffer;
> +               do {
> +                       u8 x = inb(addr);
> +                       *buf++ = x;
> +               } while (--count);
> +       }
> +}
> +
> +static inline void insw(unsigned long addr, void *buffer, int count)
> +{
> +       if (count) {
> +               u16 *buf = buffer;
> +               do {
> +                       u16 x = inw(addr);
> +                       *buf++ = x;
> +               } while (--count);
> +       }
> +}
> +
> +static inline void insl(unsigned long addr, void *buffer, int count)
> +{
> +       if (count) {
> +               u32 *buf = buffer;
> +               do {
> +                       u32 x = inl(addr);
> +                       *buf++ = x;
> +               } while (--count);
> +       }
> +}
> +
> +static inline void outsb(unsigned long addr, const void *buffer, int count)
> +{
> +       if (count) {
> +               const u8 *buf = buffer;
> +               do {
> +                       outb(*buf++, addr);
> +               } while (--count);
> +       }
> +}
> +
> +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?

> +/*
> + * Change "struct page" to physical address.
> + */

Which `struct page'?

> +static inline void *__ioremap(unsigned long offset, unsigned long size,
> +                             unsigned long flags)
> +{
> +       return (void *) offset;
> +}
> +
> +static inline void *ioremap(unsigned long offset, unsigned long size)
> +{
> +       return (void *) offset;
> +}

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds