[LinuxBIOS] [PATCH] v3 - spinlock cleanup
Stefan Reinauer
stepan at coresystems.de
Sun Jul 1 01:01:54 CEST 2007
* Uwe Hermann <uwe at hermann-uwe.de> [070701 00:57]:
> On Sun, Jul 01, 2007 at 12:46:04AM +0200, Stefan Reinauer wrote:
> > -/* Most GCC versions have a nasty bug with empty initializers */
> > -#if (__GNUC__ > 2)
> > -typedef struct { } spinlock_t;
> > -#define SPIN_LOCK_UNLOCKED (spinlock_t) { }
> > -#else
> > -typedef struct { int gcc_is_buggy; } spinlock_t;
> > -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
> > -#endif
> > -
>
> ACK. Sending a similar patch was already on my TODO list. We don't care
> about gcc <= 3, I guess.
Check the code, it will work on pre v3 like a charme. I don't know what
those Linux guys must have been smoking, but I better don't try it.
> > #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 :-)
> > +#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.
--
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info at coresystems.de • http://www.coresystems.de/
More information about the coreboot
mailing list