diff options
Diffstat (limited to 'include/asm-arm/spinlock.h')
-rw-r--r-- | include/asm-arm/spinlock.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/include/asm-arm/spinlock.h b/include/asm-arm/spinlock.h index e72553f1a..33e1fe183 100644 --- a/include/asm-arm/spinlock.h +++ b/include/asm-arm/spinlock.h @@ -4,11 +4,19 @@ #ifndef __SMP__ /* + * To be safe, we assume the only compiler that can cope with + * empty initialisers is EGCS. + */ +#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 90)) +#define EMPTY_INIT_OK +#endif + +/* * Your basic spinlocks, allowing only a single CPU anywhere */ -#if (__GNUC__ > 2) || (__GNUC_MINOR__ >= 8) +#ifdef EMPTY_INIT_OK typedef struct { } spinlock_t; -# define SPIN_LOCK_UNLOCKED { } +# define SPIN_LOCK_UNLOCKED (spinlock_t) { } #else typedef unsigned char spinlock_t; # define SPIN_LOCK_UNLOCKED 0 @@ -37,8 +45,13 @@ * irq-safe write-lock, but readers can get non-irqsafe * read-locks. */ -typedef struct { } rwlock_t; -#define RW_LOCK_UNLOCKED { } +#ifdef EMPTY_INIT_OK + typedef struct { } rwlock_t; +# define RW_LOCK_UNLOCKED (rwlock_t) { } +#else + typedef unsigned char rwlock_t; +# define RW_LOCK_UNLOCKED 0 +#endif #define read_lock(lock) do { } while(0) #define read_unlock(lock) do { } while(0) |