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

From: Geert Uytterhoeven
Date: Mon May 04 2009 - 03:07:37 EST


On Thu, Nov 6, 2008 at 15:38, Arnd Bergmann <arnd@xxxxxxxx> 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@xxxxxxxxxxxxxx

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
N‹§²æìr¸›yúèšØb²X¬¶ÇvØ^–)Þ{.nÇ+‰·¥Š{±‘êçzX§¶›¡Ü}©ž²ÆzÚ&j:+v‰¨¾«‘êçzZ+€Ê+zf£¢·hšˆ§~†­†Ûiÿûàz¹®w¥¢¸?™¨è­Ú&¢)ßf”ù^jÇy§m…á@A«a¶Úÿ 0¶ìh®å’i