Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp803468pxj; Thu, 13 May 2021 18:04:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwg6btrwZUAA+Xyh0DyjXkRyqvrxg+pdcGJmcCwCRqDkGTL40jglKjPpSz5j7r/T0B6jNW5 X-Received: by 2002:a6b:f218:: with SMTP id q24mr33180742ioh.156.1620954285836; Thu, 13 May 2021 18:04:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620954285; cv=none; d=google.com; s=arc-20160816; b=WZ+9tPq+bblEHGcbcD8A66oqbT7B2jB1AXew1p/Rbt6z3BIVxwr8fjzenYNY4haq5R WJaA6/sP8tmN3K/u86oyOVhTicjp1l3vBdOPkFItYl8USMBlvDQZbgD5/UCdcIkI+mV9 uunar8Oz1MsuEsTJsesAQzWbp7GTyvXc3rpyV9Qp4X9NPNWT1uzzLRlw1/SC5wTJxEnV Z+Rv66rqY9rPdocWAKXRtymqSnfHADB/hEsrAKHy6Wx+VBNCkHJeT8EzvSSk6RrDDXL1 1O6qXYDqtVGm6O4HdWB8i6RXehNXjnn5m9rYz6DDoc6XnoREMxrr10ckuQTVSQ9HRGgx GeSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ChUZno286ejO4yEFxhnpuo5WufJYwvQ/Qfi7oVlBimM=; b=C1x/almW6uIZ9xRufUb8Av//HfAz2dB8CvdeOwaQHdqGPKkyQUbNakvxKttikCQFKh +eDRjrYNV87v+zu/zzhbl6LhPPfuw5MmmZtM2eDzbdxgB4JdnacvADEN3XEh14taEO7/ ZlpLuaYjAkIVUfrMqBJuhFAiOrdLW5Znsagqwyhs3G7ikcq5kWccApV/dEgXYKqd8I71 Ri1V+7T5li22WSkuXWbPL/Vz0gkqJWGCKM6GA77dNhxW4XPRyZX2kgqoYq3VKQurOR42 WI9drWPi2+GQ0rxyhzv8CVTgPxWQqm09BeonvAY71A1LKxxPeWs7vYAbHUUE/M6WkKBp aFLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PloDhPaI; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x6si6419197ilv.63.2021.05.13.18.04.32; Thu, 13 May 2021 18:04:45 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PloDhPaI; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233567AbhEMVpi (ORCPT + 99 others); Thu, 13 May 2021 17:45:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233525AbhEMVpi (ORCPT ); Thu, 13 May 2021 17:45:38 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 251C9C061574 for ; Thu, 13 May 2021 14:44:28 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id t11so1421653pjm.0 for ; Thu, 13 May 2021 14:44:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ChUZno286ejO4yEFxhnpuo5WufJYwvQ/Qfi7oVlBimM=; b=PloDhPaIP6fjxoj3XhX1E9uup5Xhp+ASrfiRB7JyYkg7qSZiWp61Tf3vMKSXP0VTQb RlbxZ/OvajHiOqfGl3r4RNYXrTUb6dQ9t93EznbesEtZOODRhto54EpxRzRo5bsrYToD sRgFI0NFQi9FLq81bINsiY4oZ7IVXr/j2xpHi7gwAzbBPUennBCOMWhxXBXtzCzsFkgC Ex+M9O7hflwNpZuHLKH64IUJH7CbZLIyHGkjtOSSQF9O1W+ZEMIC7BHVZjott/030pfk nR+dyEvFdtqwnMhfR/5U11nbKABXu4HpMc33OCjdrx25aSIbxMWAT3J0Ls7BiNXJGh7Y XtPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ChUZno286ejO4yEFxhnpuo5WufJYwvQ/Qfi7oVlBimM=; b=CiTIxjUPSs/4apClOZ2Faalu7nE8A58wwN5R0Ji0YzI/jzAnpwNy5fuwqJC1lnbPwS +l4VGeU6rRnJuZxHKEak8ebUuEFDjmNU2URFaH/BID5GMe5Eu9lysB0c2UMCzR8x5ABN /cfMMtFP3+wI0j7AObtxSe676KXnUvA8Bag+56+plLz6sEq7j8UxTMOCYf2qjsmiqnO7 z06UNUeswCA51R1nt/XZZ+wyTG5UopcwjozYUmNkgZ9SpN+KfBzyQc2cVYoNXiSf8cnH kHfZ1FGFqGo63fJxFuJ53ALqluMM7ebuZOgYjlQF16Ey3pgiHjI3PwNFksfon17riK5h ljSQ== X-Gm-Message-State: AOAM533FbDcp3W5w55jixhljYBPvnpBWNRkodvoQvJY3/asgxv9yA10u Hhrpr+7mUwzdaZ6Lm7iYaJQ= X-Received: by 2002:a17:90a:8911:: with SMTP id u17mr48528788pjn.165.1620942267633; Thu, 13 May 2021 14:44:27 -0700 (PDT) Received: from localhost (g1.222-224-229.ppp.wakwak.ne.jp. [222.224.229.1]) by smtp.gmail.com with ESMTPSA id h4sm8565608pjc.12.2021.05.13.14.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 May 2021 14:44:26 -0700 (PDT) Date: Fri, 14 May 2021 06:44:25 +0900 From: Stafford Horne To: Mark Rutland Cc: linux-kernel@vger.kernel.org, will@kernel.org, boqun.feng@gmail.com, peterz@infradead.org, 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, 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, stefan.kristiansson@saunalahti.fi, tsbogend@alpha.franken.de, vgupta@synopsys.com, ysato@users.sourceforge.jp Subject: Re: [PATCH 05/33] locking/atomic: openrisc: avoid asm-generic/atomic.h Message-ID: References: <20210510093753.40683-1-mark.rutland@arm.com> <20210510093753.40683-6-mark.rutland@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210510093753.40683-6-mark.rutland@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 10, 2021 at 10:37:25AM +0100, Mark Rutland wrote: > 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. This is fine, but just a thought. If OpenRISC is the only architecture to do this then after this patch could we remove the ifndefs from asm-generic/atomic.h as additional cleanup? > 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))) Acked-by: Stafford Horne > #endif /* __ASM_OPENRISC_ATOMIC_H */ > -- > 2.11.0 >