[LinuxBIOS] [PATCH] v3 - spinlock cleanup

Uwe Hermann uwe at hermann-uwe.de
Sun Jul 1 00:57:43 CEST 2007


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.


>  #define barrier()              do {} while(0)
>  #define spin_is_locked(lock)   0
>  #define spin_unlock_wait(lock) do {} while(0)
>  #define spin_lock(lock)                do {} while(0)
>  #define spin_unlock(lock)      do {} while(0)
> +#define spin_define(lock)       /* empty */

Why not this?
#define spin_define(lock) do {} while(0)


> +#define spin_define(spin) static struct spinlock spin = SPIN_LOCK_UNLOCKED

Uh, that looks like an inline function might be better here.


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/40bb9c2f/attachment.sig>


More information about the coreboot mailing list