From patchwork Tue Oct 20 05:33:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Randy Dunlap X-Patchwork-Id: 1384624 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=sparclinux-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=S+Q0/85f; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CFj381lW7z9sRK for ; Tue, 20 Oct 2020 16:33:40 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391632AbgJTFdj (ORCPT ); Tue, 20 Oct 2020 01:33:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730152AbgJTFdj (ORCPT ); Tue, 20 Oct 2020 01:33:39 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E08D9C0613CE for ; Mon, 19 Oct 2020 22:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=nCa9o5VjiCJgNOkmNLaWCX+FLMqiMx339DNspLn0DNM=; b=S+Q0/85fjknIaiWZqHDxBbIMZi pP3Gtbzod6Pdq+mAVbSFHVYTEzpg6W1JqoqAycsHq9XhtCzGztNlK6Vs3YQd5q6Ba7D0niXlmrSXD Rn3Fr03o3CF2F91ZpaGpGa71IbrEf3VBkXkQfo1+WU14YekE/S2RwFv9z9+7Eg+WUfQP/0VpRvxn8 enlappVFBWQenoBVZn+rWVlk9YUMNPu0B9GppCqw7q0lrZkApRwfWpbaRr1uW7xg4m9Zs5lbBPS45 juXjT0VjI0WACTtBPu2i2RjZTsTu17rCqnjrZp7dB2Hg6pOyySj4nksBRT1zHUj1rj803qNMfdSe2 Gn/ugqQw==; Received: from [2601:1c0:6280:3f0::507c] (helo=smtpauth.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUkH6-0005Jl-85; Tue, 20 Oct 2020 05:33:33 +0000 From: Randy Dunlap Cc: Randy Dunlap , Arnd Bergmann , "David S. Miller" , sparclinux@vger.kernel.org Subject: [PATCH] sparc: make xchg() into a statement expression Date: Mon, 19 Oct 2020 22:33:28 -0700 Message-Id: <20201020053328.17332-1-rdunlap@infradead.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org Fix several of the same warning by using a GCC statement expression (extension): ../arch/sparc/include/asm/cmpxchg_32.h:28:22: warning: value computed is not used [-Wunused-value] 28 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) Passes sparc32 allmodconfig with no xchg warnings. Signed-off-by: Randy Dunlap Cc: Arnd Bergmann Cc: "David S. Miller" Cc: sparclinux@vger.kernel.org --- This is similar to a patch from Arnd for m68k: https://lore.kernel.org/linux-m68k/20201008123429.1133896-1-arnd@arndb.de/ arch/sparc/include/asm/cmpxchg_32.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- linux-next-20201009.orig/arch/sparc/include/asm/cmpxchg_32.h +++ linux-next-20201009/arch/sparc/include/asm/cmpxchg_32.h @@ -25,7 +25,7 @@ static inline unsigned long __xchg(unsig return x; } -#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) +#define xchg(ptr,x) ({(__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)));}) /* Emulate cmpxchg() the same way we emulate atomics, * by hashing the object address and indexing into an array