[PATCH 2/2] staging: brcm80211: replace asserts close to Mac80211 interface

Arend van Spriel arend at broadcom.com
Thu Mar 31 09:30:46 UTC 2011


On Wed, 30 Mar 2011 13:08:32 +0200, Dan Carpenter <error27 at gmail.com>  
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"




More information about the devel mailing list