From patchwork Fri Jun 22 00:35:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 10480973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 53CB960388 for ; Fri, 22 Jun 2018 00:35:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42FD128D83 for ; Fri, 22 Jun 2018 00:35:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3696C28E24; Fri, 22 Jun 2018 00:35:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BDC9728D83 for ; Fri, 22 Jun 2018 00:35:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Mtz9wvpYn4ugBj0yEbn8mDlBNGcjdX2Fd/ricmLGmOc=; b=mJ6a5iGpY/Ic5j +tA+CwJT3Njmzei9/fmU+D91i+S6zSWiMA9L1MJnb82XHzOJhYn0jr5XX+TOJlOnjzR3fMU2+ZswU ZaoUFH4lNDMvCygg0BpDMwilF3lvNv8x8IkJ3gkpKzRJMttGuaeNgFZlgLb+6m4lFqEi9Nk1MrnCh pxuVKD3AyLQx7HopwOPFY/nHOW1gKaqcniBFbH8M5ye37VNcHVqv5GEf74wKSN7HqCuxwiSqVMBLk OwzzwkZYt2Sbm7ioBwo2H3UorE74HOn84SjPdSopNZpyVA1D0GdZyvdxL+puy/0xeOcwCvhtOH/uo nG+ZZoQaFIcOkOZubSUw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fWA3F-0004sN-Q0; Fri, 22 Jun 2018 00:35:45 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fWA3C-0004r7-42 for linux-arm-kernel@lists.infradead.org; Fri, 22 Jun 2018 00:35:44 +0000 Received: from vmware.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D2CA822AC6; Fri, 22 Jun 2018 00:35:28 +0000 (UTC) Date: Thu, 21 Jun 2018 20:35:26 -0400 From: Steven Rostedt To: LKML Subject: [PATCH] locking/qspinlock: Fix build for anonymous union in older gcc compilers Message-ID: <20180621203526.172ab5c4@vmware.local.home> X-Mailer: Claws Mail 3.15.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180621_173542_211747_D1837F05 X-CRM114-Status: GOOD ( 10.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Peter Zijlstra \(Intel\)" , Boqun Feng , Will Deacon , Waiman Long , Andrew Morton , Linus Torvalds , Ingo Molnar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Steven Rostedt (VMware) One of my tests compiles the kernel with gcc 4.5.3, and I hit the following build error: /work/git/linux-trace.git/include/linux/semaphore.h: In function 'sema_init': /work/git/linux-trace.git/include/linux/semaphore.h:35:17: error: unknown field 'val' specified in initializer /work/git/linux-trace.git/include/linux/semaphore.h:35:17: warning: missing braces around initializer /work/git/linux-trace.git/include/linux/semaphore.h:35:17: warning: (near initialization for '(anonymous).raw_lock..val') In file included from /work/git/linux-trace.git/include/linux/sched/user.h:7:0, from /work/git/linux-trace.git/include/linux/cred.h:22, from /work/git/linux-trace.git/include/linux/seq_file.h:12, from /work/git/linux-trace.git/include/linux/cgroup.h:18, from /work/git/linux-trace.git/include/linux/memcontrol.h:22, from /work/git/linux-trace.git/include/linux/swap.h:9, from /work/git/linux-trace.git/include/linux/suspend.h:5, from /work/git/linux-trace.git/arch/x86/kernel/asm-offsets.c:13: I bisected it down to the introduction of the commit that makes qspinlock have an anonymous union, which makes initializing it special for older compilers. By adding strategic brackets, it makes the build happy again. Fixes: 625e88be1f41 ("locking/qspinlock: Merge 'struct __qspinlock' into 'struct qspinlock'") Signed-off-by: Steven Rostedt (VMware) Acked-by: Waiman Long Acked-by: Will Deacon diff --git a/include/asm-generic/qspinlock_types.h b/include/asm-generic/qspinlock_types.h index 0763f065b975..d10f1e7d6ba8 100644 --- a/include/asm-generic/qspinlock_types.h +++ b/include/asm-generic/qspinlock_types.h @@ -63,7 +63,7 @@ typedef struct qspinlock { /* * Initializier */ -#define __ARCH_SPIN_LOCK_UNLOCKED { .val = ATOMIC_INIT(0) } +#define __ARCH_SPIN_LOCK_UNLOCKED { { .val = ATOMIC_INIT(0) } } /* * Bitfields in the atomic value: