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

From: Philipp Rumpf (prumpf@inwestnet.de)
Date: Sat Feb 12 2000 - 15:50:22 EST


> > So you want to do that for IP too (and all other network protocols) ? Ext2
> > (all other file systems) ?

> I wasn't saying that. However, I believe that the use of structures to
> represent hardware devices is abserd. All datasheets I have ever seen
> describe devices as a set of offsets from the start address.

a structure's members are in a separate namespace, so you can avoid using
a prefix string all over the place. Also, you can use the same name as
the documentation does (some hardware manufacturers like repeating the
obvious prefix string in some of the register name, so you'd end up with
FOO_FOO_XMIT vs FOO_RCV). Some people also like to use upper case for
macros, which doesn't work with mixed-caps register names.

structs are nice for repeated patterns in the MMIO space.

> The raw information is numeric. Why go to the pain of converting this to
> a compiler-based structure, and then get the compiler to convert it back
> to offsets again? It's not like you're using typechecking or any other
> features of a structure.

One of the points against structs for offsets is that some day, someone
will be too smart for their own good and do

#define write(x,p) switch(sizeof *p) { \
case 4: writel(x,p); break; \
case 2: writew(x,p); break; \
case 1: writeb(x,p); break; \
}

but that it can be abused isn't an argument against using it, is it ?

        Philipp

-
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:23 EST