From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752020AbdJZEyC (ORCPT ); Thu, 26 Oct 2017 00:54:02 -0400 Received: from smtprelay0223.hostedemail.com ([216.40.44.223]:56717 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751520AbdJZEyA (ORCPT ); Thu, 26 Oct 2017 00:54:00 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 10,1,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1431:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:1981:2194:2199:2393:2559:2562:2828:2919:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3870:3871:3872:3874:4321:4605:5007:6119:7903:8603:10007:10400:10848:11026:11232:11657:11658:11914:12043:12438:12555:12663:12740:12760:12895:13439:14096:14097:14181:14659:14721:21080:21451:21627:30012:30036:30054:30055:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:1:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: back41_5c46e8bdfa032 X-Filterd-Recvd-Size: 2844 Message-ID: <1508993632.10651.19.camel@perches.com> Subject: Re: [PATCH v2] sparc: Provide cmpxchg64 for 32-bit builds From: Joe Perches To: Guenter Roeck , "David S . Miller" Cc: sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 25 Oct 2017 21:53:52 -0700 In-Reply-To: <1508986312-32081-1-git-send-email-linux@roeck-us.net> References: <1508986312-32081-1-git-send-email-linux@roeck-us.net> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2017-10-25 at 19:51 -0700, Guenter Roeck wrote: > Fix the following build error, seen when building sparc32:allmodconfig. > > drivers/net/ethernet/intel/i40e/i40e_ethtool.c: > In function 'i40e_set_priv_flags': > drivers/net/ethernet/intel/i40e/i40e_ethtool.c:4150:2: error: > implicit declaration of function 'cmpxchg64' > > Signed-off-by: Guenter Roeck > --- > v2: Actually implement cmpxchg64 with code snippet provided by Dave Miller > Note: I am aware that this doesn't pass checkpatch; I found it more > important to be in line with __cmpxchg_u32(). > > arch/sparc/include/asm/cmpxchg_32.h | 2 ++ > arch/sparc/lib/atomic32.c | 14 ++++++++++++++ > 2 files changed, 16 insertions(+) > > diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h > index 83ffb83c5397..7f95d3ca20e2 100644 > --- a/arch/sparc/include/asm/cmpxchg_32.h > +++ b/arch/sparc/include/asm/cmpxchg_32.h > @@ -62,6 +62,8 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) > (unsigned long)_n_, sizeof(*(ptr))); \ > }) > > +extern u64 cmpxchg64(u64 *ptr, u64 old, u64 new); This extern is unusual style for sparc function declarations. > + > #include > > /* > diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c > index 2c373329d5cb..41601eb540e7 100644 > --- a/arch/sparc/lib/atomic32.c > +++ b/arch/sparc/lib/atomic32.c > @@ -172,6 +172,20 @@ unsigned long __cmpxchg_u32(volatile u32 *ptr, u32 old, u32 new) > } > EXPORT_SYMBOL(__cmpxchg_u32); > > +u64 cmpxchg64(u64 *ptr, u64 old, u64 new) > +{ > + unsigned long flags; > + u64 prev; > + > + spin_lock_irqsave(ATOMIC_HASH(ptr), flags); > + if ((prev = *ptr) == old) > + *ptr = new; > + spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags); > + > + return prev; > +} > +EXPORT_SYMBOL(cmpxchg64); > + > unsigned long __xchg_u32(volatile u32 *ptr, u32 new) > { > unsigned long flags;