lkml.org 
[lkml]   [2018]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv2 05/16] atomics: prepare for atomic64_fetch_add_unless()
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?

> + */
> +#ifdef atomic64_fetch_add_unless
> +static inline int atomic64_add_unless(atomic64_t *v, long long a, long long u)

Do we want to make that a "bool' return?

> +{
> + return atomic64_fetch_add_unless(v, a, u) != u;
> +}
> +#endif

\
 
 \ /
  Last update: 2018-06-05 11:28    [W:1.364 / U:0.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site