From: David Vrabel Subject: [PATCHv1] spinlock: fix build with older GCC Date: Tue, 19 May 2015 13:52:25 +0100 Message-ID: <1432039945-11402-1-git-send-email-david.vrabel@citrix.com> References: <555B2EAC020000780007B935@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yuh1F-0005UV-FU for xen-devel@lists.xenproject.org; Tue, 19 May 2015 12:53:13 +0000 In-Reply-To: <555B2EAC020000780007B935@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Keir Fraser , Tim Deegan , David Vrabel , Jan Beulich , Ian Campbell List-Id: xen-devel@lists.xenproject.org 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 --- xen/common/spinlock.c | 2 +- xen/include/xen/spinlock.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c index c8dc8ba..29149d1 100644 --- a/xen/common/spinlock.c +++ b/xen/common/spinlock.c @@ -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); diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h index 311685a..9286543 100644 --- a/xen/include/xen/spinlock.h +++ b/xen/include/xen/spinlock.h @@ -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; -- 1.7.10.4