On Wed, 30 Mar 2011 13:08:32 +0200, Dan Carpenter <error27@xxxxxxxxx>
wrote:
I don't like the W_REG() and R_REG() macros much either. The caller
should
state explicitly if the are reading a byte, short or int something
like brd_readb().
It should be a function so it has type checking. The current code is
just
guessing based on the type of variable... It's asking for bugs.
Hi Dan,
I tend to agree on most specifics you are indicating. Thanks for this
valuable input. You may have guessed from the quoted part above that I
want to argue a 'but..' on this. In the driver the W_REG and R_REG macros
are and should always be used with a structure definition of the register
area. This assures two things. The memory mapped i/o is done at the right
offset and with the right accessor function. All this information is
located in one place (which I prefer) namely in the structure definition.
Of course it is not guaranteed that developers will stick to this use of
the macros, but requiring them to use specific functions puts the register
map information in multiple places.
Gr. AvS
--
"The most merciful thing in the world, I think, is the inability of the
human
mind to correlate all its contents." - "The Call of Cthulhu"
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel