Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2426754pxj; Mon, 10 May 2021 02:41:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSN/E7BnQzZkWaWwFaGmSTLnwPET7PY31V4xt38HGNnTNanar/M7CPpOq/+gU539urmHc0 X-Received: by 2002:a92:650d:: with SMTP id z13mr7012977ilb.193.1620639669699; Mon, 10 May 2021 02:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620639669; cv=none; d=google.com; s=arc-20160816; b=FbIVIC1YXLO5yqQ1+ixB3LDA2z3YEr5QWMDqJdI2AkbtJsD1Sba24hiAXnNixwWko7 4mmpeF5H+Rs80wyMupKUbjh2stXv8fFhtSvfGkFQRzCsul8MCPbTIwAAFc6GF5LZ/nX5 fBBzmGOJ5dv48SCqDyjik1sIfK/6+HUP+fv1/zqK6DHiXLAFXjKv4YtETux6h/Uc/WLP J+yjfc3svgs8F+JgCzG/KCugjfgMA728xtu6dzDDMsQQBfi3Btb30TkZiRnCRpZzdQBk 7weo1zY7jZRZL0kjmGTgQSSGOYdF+DyrKYNXlUDfZC+gAe9Ud1N2T7jn3wAAS285r9I9 X7gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=vZioVgcXe/mspSAlmLd/Or8C5Pt+eyBeMQih786J3CA=; b=glowan1rSJNcjqQj1tO8N0O2fnU3CGeKTgCi/tEwgUotR/CIyPxC33UJydJhvm8vlv 4iZne+E1cPvDPnyOdh7KOEIPDqWOkDiYz8nFRRbq0Zu3CZ5M3jRaCR1FkabuhZ0Xo9lf LwfgzjZHp7qMJ4NIBHPIHiGu5bpjziSvUzzOG2Q5dYxIeNDXGi1Cr6o4NNgbzdvMBD07 HcR1VkFjQBfeNtLI1Ya83Tlr/Bjtt2swvYX+oKr8am9bQP+azF5+fDkPDGaKqauFHHJ+ M6a+594n2BeJwkbMzjG8Vi9MlwfxbxmIJO4llB31N+5kTcqXUs5gIOkDkD2cNuEk+9gD ec+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t17si4867566ilj.128.2021.05.10.02.40.57; Mon, 10 May 2021 02:41:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230333AbhEJJk6 (ORCPT + 99 others); Mon, 10 May 2021 05:40:58 -0400 Received: from foss.arm.com ([217.140.110.172]:50644 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230360AbhEJJkx (ORCPT ); Mon, 10 May 2021 05:40:53 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5AC3713A1; Mon, 10 May 2021 02:39:49 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2E24C3F7D8; Mon, 10 May 2021 02:39:45 -0700 (PDT) From: Mark Rutland To: linux-kernel@vger.kernel.org, will@kernel.org, boqun.feng@gmail.com, peterz@infradead.org Cc: aou@eecs.berkeley.edu, arnd@arndb.de, bcain@codeaurora.org, benh@kernel.crashing.org, chris@zankel.net, dalias@libc.org, davem@davemloft.net, deanbo422@gmail.com, deller@gmx.de, geert@linux-m68k.org, green.hu@gmail.com, guoren@kernel.org, ink@jurassic.park.msu.ru, James.Bottomley@HansenPartnership.com, jcmvbkbc@gmail.com, jonas@southpole.se, ley.foon.tan@intel.com, linux@armlinux.org.uk, mark.rutland@arm.com, mattst88@gmail.com, monstr@monstr.eu, mpe@ellerman.id.au, nickhu@andestech.com, palmer@dabbelt.com, paulus@samba.org, paul.walmsley@sifive.com, rth@twiddle.net, shorne@gmail.com, stefan.kristiansson@saunalahti.fi, tsbogend@alpha.franken.de, vgupta@synopsys.com, ysato@users.sourceforge.jp Subject: [PATCH 05/33] locking/atomic: openrisc: avoid asm-generic/atomic.h Date: Mon, 10 May 2021 10:37:25 +0100 Message-Id: <20210510093753.40683-6-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210510093753.40683-1-mark.rutland@arm.com> References: <20210510093753.40683-1-mark.rutland@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org OpenRISC is the only architecture which uses asm-generic/atomic.h and also provides its own implementation of some functions, requiring ifdeferry in the asm-generic header. As OpenRISC provides the vast majority of functions itself, it would be simpler overall if it also provided the few functions it cribs from asm-generic. This patch decouples OpenRISC from asm-generic/atomic.h. Subsequent patches will simplify the asm-generic implementation. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Cc: Boqun Feng Cc: Jonas Bonn Cc: Peter Zijlstra Cc: Stafford Horne Cc: Stefan Kristiansson Cc: Will Deacon --- arch/openrisc/include/asm/atomic.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/openrisc/include/asm/atomic.h b/arch/openrisc/include/asm/atomic.h index b589fac39b92..cb86970d3859 100644 --- a/arch/openrisc/include/asm/atomic.h +++ b/arch/openrisc/include/asm/atomic.h @@ -121,6 +121,12 @@ static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u) } #define atomic_fetch_add_unless atomic_fetch_add_unless -#include +#define atomic_read(v) READ_ONCE((v)->counter) +#define atomic_set(v,i) WRITE_ONCE((v)->counter, (i)) + +#include + +#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v))) +#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new))) #endif /* __ASM_OPENRISC_ATOMIC_H */ -- 2.11.0