linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, Boqun Feng <boqun.feng@gmail.com>,
	Will Deacon <will.deacon@arm.com>, Arnd Bergmann <arnd@arndb.de>,
	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Matt Turner <mattst88@gmail.com>,
	Vineet Gupta <vgupta@synopsys.com>,
	Russell King <linux@armlinux.org.uk>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Palmer Dabbelt <palmer@sifive.com>, Albert Ou <albert@sifive.com>
Subject: Re: [PATCHv2 05/16] atomics: prepare for atomic64_fetch_add_unless()
Date: Wed, 06 Jun 2018 18:57:34 +1000	[thread overview]
Message-ID: <87tvqgmgw1.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <20180605110808.5ms6kbsayj2dbo7z@lakrids.cambridge.arm.com>

Mark Rutland <mark.rutland@arm.com> writes:

> On Tue, Jun 05, 2018 at 08:54:03PM +1000, Michael Ellerman wrote:
>> Mark Rutland <mark.rutland@arm.com> writes:
>> > On Tue, Jun 05, 2018 at 11:26:37AM +0200, Peter Zijlstra wrote:
>> >> On Tue, May 29, 2018 at 04:43:35PM +0100, Mark Rutland wrote:
>> >> >  /**
>> >> > + * atomic64_add_unless - add unless the number is already a given value
>> >> > + * @v: pointer of type atomic_t
>> >> > + * @a: the amount to add to v...
>> >> > + * @u: ...unless v is equal to u.
>> >> > + *
>> >> > + * Atomically adds @a to @v, so long as @v was not already @u.
>> >> > + * Returns non-zero if @v was not @u, and zero otherwise.
>> >> 
>> >> I always get confused by that wording; would something like: "Returns
>> >> true if the addition was done" not be more clear?
>> >
>> > Sounds clearer to me; I just stole the wording from the existing
>> > atomic_add_unless().
>> >
>> > I guess you'll want similar for the conditional inc/dec ops, e.g.
>> >
>> > /**
>> >  * atomic_inc_not_zero - increment unless the number is zero
>> >  * @v: pointer of type atomic_t
>> >  *
>> >  * Atomically increments @v by 1, so long as @v is non-zero.
>> >  * Returns non-zero if @v was non-zero, and zero otherwise.
>> >  */
>> 
>> If we're bike-shedding .. :)
>> 
>> I think "so long as" is overly wordy and not helpful. It'd be clearer
>> just as:
>> 
>>   * Atomically increments @v by 1, if @v is non-zero.
>
> I agree; done.

Thanks.

cheers

  reply	other threads:[~2018-06-06  8:57 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-29 15:43 [PATCHv2 00/16] atomics: API cleanups Mark Rutland
2018-05-29 15:43 ` [PATCHv2 01/16] atomics/treewide: s/__atomic_add_unless/atomic_fetch_add_unless/ Mark Rutland
2018-06-04 23:24   ` Palmer Dabbelt
2018-05-29 15:43 ` [PATCHv2 02/16] atomics/treewide: remove redundant atomic_inc_not_zero() definitions Mark Rutland
2018-06-04 23:24   ` Palmer Dabbelt
2018-05-29 15:43 ` [PATCHv2 03/16] atomics/treewide: make atomic64_inc_not_zero() optional Mark Rutland
2018-06-04 23:17   ` Palmer Dabbelt
2018-06-05  5:34     ` Mark Rutland
2018-05-29 15:43 ` [PATCHv2 04/16] atomics/treewide: make atomic_fetch_add_unless() optional Mark Rutland
2018-06-04 23:24   ` Palmer Dabbelt
2018-05-29 15:43 ` [PATCHv2 05/16] atomics: prepare for atomic64_fetch_add_unless() Mark Rutland
2018-06-05  9:26   ` Peter Zijlstra
2018-06-05  9:53     ` Mark Rutland
2018-06-05 10:54       ` Michael Ellerman
2018-06-05 11:08         ` Mark Rutland
2018-06-06  8:57           ` Michael Ellerman [this message]
2018-05-29 15:43 ` [PATCHv2 06/16] atomics/generic: define atomic64_fetch_add_unless() Mark Rutland
2018-05-29 15:43 ` [PATCHv2 07/16] atomics/alpha: " Mark Rutland
2018-05-29 15:43 ` [PATCHv2 08/16] atomics/arc: " Mark Rutland
2018-05-29 15:43 ` [PATCHv2 09/16] atomics/arm: " Mark Rutland
2018-05-29 15:43 ` [PATCHv2 10/16] atomics/powerpc: " Mark Rutland
2018-05-29 15:43 ` [PATCHv2 11/16] atomics/riscv: " Mark Rutland
2018-06-04 23:17   ` Palmer Dabbelt
2018-05-29 15:43 ` [PATCHv2 12/16] atomics/treewide: make atomic64_fetch_add_unless() optional Mark Rutland
2018-05-29 15:43 ` [PATCHv2 13/16] atomics/treewide: make test ops optional Mark Rutland
2018-06-04 23:17   ` Palmer Dabbelt
2018-05-29 15:43 ` [PATCHv2 14/16] atomics/treewide: remove atomic_inc_not_zero_hint() Mark Rutland
2018-05-29 15:43 ` [PATCHv2 15/16] atomics/treewide: make unconditional inc/dec ops optional Mark Rutland
2018-06-04 23:17   ` Palmer Dabbelt
2018-05-29 15:43 ` [PATCHv2 16/16] atomics/treewide: make conditional " Mark Rutland
2018-05-30 11:23 ` [PATCHv2 00/16] atomics: API cleanups Mark Rutland
2018-05-30 13:34   ` Mark Rutland
2018-06-05  9:43 ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tvqgmgw1.fsf@concordia.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=albert@sifive.com \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=boqun.feng@gmail.com \
    --cc=ink@jurassic.park.msu.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=mattst88@gmail.com \
    --cc=palmer@sifive.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=rth@twiddle.net \
    --cc=vgupta@synopsys.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).