spinlock: fix build with older GCC

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>
This commit is contained in:
David Vrabel authored and Jan Beulich committed 2015-05-19 15:49:22 +02:00
1 parent db83975f0f
commit 1037e33c88
2 files changed
+3 -1

No files matched your search

+1 -1
View 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);
+2
View 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;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.