Re: [PATCH] isa_{read,write}{w,l} fixed

From: Jeff Garzik (jgarzik@mandrakesoft.com)
Date: Fri Feb 11 2000 - 06:33:36 EST


Philipp Rumpf wrote:
>
> > I do. And the patch is wrong. Physical addresses are unsigned long. Take the
> > errors as a chance to fix up the types in the driver.
>
> I disagree. A lot of drivers seem to use structs as a cheap way to get
> separate namespaces for their readl() / sbus_readl() offsets, and inconsistent
> behaviour between readb() and isa_readb() (as well as isa_readb() on ARM
> and isa_reab() on x86) would be unnecessarily confusing.

Two key points here --

* isa_xxx are only to ease the transition to newstyle ioremap. if you
are hacking code, go ahead and update it to use
ioremap/readX/writeX/iounmap.

* You can never directly use a struct to access an offset in MMIO
space. To do so is broken and bad bad bad. The only acceptable way is

        my_struct = ioremap (...);
        my_reg = readb(&my_struct->foo_register);

I much prefer to avoid structs, and use macros to access registers
instead:

        my_reg = RTL_R8 (FooRegisterConstant);

Regards,

        Jeff

-- 
Jeff Garzik         | "Vegetarian" is the Indian word
Building 1024       | for 'lousy hunter.'
MandrakeSoft, Inc.  |

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:20 EST