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.