From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH 20/20] arch: Rewrite generic atomic support Date: Thu, 8 May 2014 20:26:42 +0200 Message-ID: <20140508182642.GL2844@laptop.programming.kicks-ass.net> References: <20140508135840.956784204@infradead.org> <20140508135852.940119622@infradead.org> <20140508152401.GA5177@ravnborg.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8BIT Return-path: Received: from casper.infradead.org ([85.118.1.10]:45201 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752840AbaEHS0p convert rfc822-to-8bit (ORCPT ); Thu, 8 May 2014 14:26:45 -0400 Content-Disposition: inline In-Reply-To: <20140508152401.GA5177@ravnborg.org> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Sam Ravnborg Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, mingo@kernel.org, will.deacon@arm.com, paulmck@linux.vnet.ibm.com, Arnd Bergmann , David Howells On Thu, May 08, 2014 at 05:24:01PM +0200, Sam Ravnborg wrote: > > > > -/** > > - * atomic_add_return - add integer to atomic variable > > - * @i: integer value to add > > - * @v: pointer of type atomic_t > > - * > > - * Atomically adds @i to @v and returns the result > > - */ > For people not starign at kernel code every days these sparse comments > is a help. If anything they should be improved rather than deleted. Does something like this help? Its a bit tedious to have to repeat the comment while we just collapsed all the implementations. --- a/include/asm-generic/atomic.h +++ b/include/asm-generic/atomic.h @@ -18,6 +18,23 @@ #include #include +/* + * atomic_$op() - $op integer to atomic variable + * @i: integer value to $op + * @v: pointer to the atomic variable + * + * Atomically $ops @i to @v. Does not strictly guarantee a memory-barrier, use + * smp_mb__{before,after}_atomic(). + */ + +/* + * atomic_$op_return() - $op interer to atomic variable and returns the result + * @i: integer value to $op + * @v: pointer to the atomic variable + * + * Atomically $ops @i to @v. Does imply a full memory barrier. + */ + #ifdef CONFIG_SMP /* we can build all atomic primitives from cmpxchg */