1 Jul 01:01
Re: [PATCH] v3 - spinlock cleanup
Stefan Reinauer <stepan <at> coresystems.de>
2007-06-30 23:01:54 GMT
2007-06-30 23:01:54 GMT
* 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.
(Continue reading)
RSS Feed