[U-Boot] [PATCH 2/3] dnet: driver for Dave DNET ethernet controller
Ilya Yanok
yanok at emcraft.com
Wed Feb 11 20:40:42 CET 2009
Dear Wolfgang,
Wolfgang Denk wrote:
>> nothing magical in offsets actually... we usually have offsets in specs
>> not C structures...
>>
>
> Just to name one reason (but a very important one): using a struct
> allows for strict type checking by the compiler. If you use address +
> offset you will not get any help from the compiler when you for
> example read 8 bit from a register that must be accessed as a 32 bit
> entity.
>
But this works only if we use "memory-style" IO access, if we use
read/write accessor functions that info we be lost as all pointers we be
silently converted into void*... And using "memory-style" IO access is
strongly discouraged in the kernel...
BTW, what is the general rule for U-Boot? I can see that most accesses
are done "memory-style" but I can see accessor functions used here and
there...
Regards, Ilya.
More information about the U-Boot
mailing list