spinlock: fix build with older GCC
authorDavid Vrabel <david.vrabel@citrix.com>
Tue, 19 May 2015 13:49:22 +0000 (15:49 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 19 May 2015 13:49:22 +0000 (15:49 +0200)
Older GCC versions such as 4.3 cannot have initializers for the
members of anonymous structures, so initialize .head_tail instead.

Use a SPINLOCK_TICKET_INC define so this initializer is near the
spinlock_tickets_t definition (in case the structure changes requiring
changes to the initializer).

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reported-and-tested-by: Jan Beulich <jbeulich@suse.com>
xen/common/spinlock.c
xen/include/xen/spinlock.h

index c8dc8ba3dc46142dec6bcf5551d50a86119fc82a..29149d15378f2b4b45deb3f5b8f28870323ce5c3 100644 (file)
@@ -132,7 +132,7 @@ static always_inline u16 observe_head(spinlock_tickets_t *t)
 
 void _spin_lock(spinlock_t *lock)
 {
-    spinlock_tickets_t tickets = { .tail = 1, };
+    spinlock_tickets_t tickets = SPINLOCK_TICKET_INC;
     LOCK_PROFILE_VAR;
 
     check_lock(&lock->debug);
index 311685a011fff45c7ab37bf9c6a80433204c1a46..9286543beab5a67c19ede8f71f0ef55a22bc9942 100644 (file)
@@ -132,6 +132,8 @@ typedef union {
     };
 } spinlock_tickets_t;
 
+#define SPINLOCK_TICKET_INC { .head_tail = 0x10000, }
+
 typedef struct spinlock {
     spinlock_tickets_t tickets;
     u16 recurse_cpu:12;