[LinuxBIOS] [PATCH] v3 - spinlock cleanup

Uwe Hermann uwe at hermann-uwe.de
Sun Jul 1 02:14:03 CEST 2007


On Sun, Jul 01, 2007 at 01:01:54AM +0200, Stefan Reinauer wrote:
> > >  #define spin_unlock(lock)      do {} while(0)
> > > +#define spin_define(lock)       /* empty */
> > 
> > Why not this?
> > #define spin_define(lock) do {} while(0)
>  
> Haha. I had this first. But a do .. while construct outside a function
> scope is nothing gcc (or any other compiler) would handle :-)

Yep.

 
> > > +#define spin_define(spin) static struct spinlock spin = SPIN_LOCK_UNLOCKED
> > 
> > Uh, that looks like an inline function might be better here.
> 
> Not sure I get what you mean.. This one defines a (file) global
> variable.

OK, I totally misread what the code is supposed to do.

I'm not sure the spin_define() is such a good idea then. It has a nice
name and all, but it might be obfuscating things more than necessary.
Maybe a simple variable declaration (i.e., drop the #define) would be better?


Uwe.
-- 
http://www.hermann-uwe.de  | http://www.holsham-traders.de
http://www.crazy-hacks.org | http://www.unmaintained-free-software.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20070701/5956e727/attachment.sig>


More information about the coreboot mailing list