From patchwork Wed Nov 18 00:04:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 7643721 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A48A3BF90C for ; Wed, 18 Nov 2015 00:07:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD59E20513 for ; Wed, 18 Nov 2015 00:07:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B4A1B204EC for ; Wed, 18 Nov 2015 00:07:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZyqFe-00045s-Po; Wed, 18 Nov 2015 00:05:30 +0000 Received: from mail-ig0-x22e.google.com ([2607:f8b0:4001:c05::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZyqFa-00036s-80 for linux-arm-kernel@lists.infradead.org; Wed, 18 Nov 2015 00:05:26 +0000 Received: by igbxm8 with SMTP id xm8so26575688igb.1 for ; Tue, 17 Nov 2015 16:05:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=6cLx8DyrcxwRdSYc5aaxMG8zb0cxBcxgSNYNykoaRxk=; b=cLvzryCIm0rXhYIGx4TDbxXskI4zkZ6yQdRkkGDazW9bKXYFCHxn9VT/FhmlhohiUo RAASBDTIz+iBcsqJuT5OqseKmrXGI1S+NhkaSj5wHcgRANxlc81JxhJVUDB09oMzKqD8 Eoa3z9ftf1ovzbrCeVwEtGTiUXkDf8a/bUNv1tW63W+4irahHqDj8gEwKi46Lajobcgw 8I6B2lzG9dWbkn3WaKzOMC39v37pWgM3cmKbjPJy65/rf8GP8EZM4aTv37IAEtt/uPc8 Jv1jDgBSd+u7aNxt9HZWe66dEllpt0ae1djBubMElNvthY5z/BZeiTv+ik2i7RBtvTW/ jSdw== X-Received: by 10.50.79.201 with SMTP id l9mr5029855igx.60.1447805105002; Tue, 17 Nov 2015 16:05:05 -0800 (PST) Received: from dl.caveonetworks.com ([64.2.3.194]) by smtp.gmail.com with ESMTPSA id l5sm242957ioa.17.2015.11.17.16.05.03 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 17 Nov 2015 16:05:03 -0800 (PST) Received: from dl.caveonetworks.com (localhost.localdomain [127.0.0.1]) by dl.caveonetworks.com (8.14.5/8.14.5) with ESMTP id tAI051kX008751; Tue, 17 Nov 2015 16:05:01 -0800 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id tAI04tPV008749; Tue, 17 Nov 2015 16:04:55 -0800 From: David Daney To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Will Deacon , Catalin Marinas , Peter Zijlstra , Andre Przywara Subject: [PATCH] arm64: Make smp_load_acquire() work with pointer to const argument. Date: Tue, 17 Nov 2015 16:04:53 -0800 Message-Id: <1447805093-8716-1-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151117_160526_390508_3D7F70D7 X-CRM114-Status: GOOD ( 12.29 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Daney Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: David Daney We are now getting this error when building: . . . CC init/do_mounts.o In file included from include/linux/tcp.h:22:0, from include/linux/ipv6.h:72, from include/net/ipv6.h:16, from include/linux/sunrpc/clnt.h:27, from include/linux/nfs_fs.h:30, from init/do_mounts.c:32: include/net/sock.h: In function ‘sk_state_load’: include/net/sock.h:2238:2: error: read-only variable ‘___p1’ used as ‘asm’ output return smp_load_acquire(&sk->sk_state); ^ include/net/sock.h:2238:2: error: read-only variable ‘___p1’ used as ‘asm’ output include/net/sock.h:2238:2: error: read-only variable ‘___p1’ used as ‘asm’ output include/net/sock.h:2238:2: error: read-only variable ‘___p1’ used as ‘asm’ output . . . Fix the smp_load_acquire() implementation to discard the const qualifier in the type of the temporary variable with some tricky casting. Signed-off-by: David Daney --- arch/arm64/include/asm/barrier.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h index 624f967..52eb9b9 100644 --- a/arch/arm64/include/asm/barrier.h +++ b/arch/arm64/include/asm/barrier.h @@ -64,7 +64,8 @@ do { \ #define smp_load_acquire(p) \ ({ \ - typeof(*p) ___p1; \ + typeof((typeof(*p))(*p + 0)) ___p1; \ + compiletime_assert(sizeof(___p1) == sizeof(*p), "remove const"); \ compiletime_assert_atomic_type(*p); \ switch (sizeof(*p)) { \ case 1: \