summaryrefslogtreecommitdiffstats
path: root/lib/atomic64.c
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2018-06-21 13:13:07 +0100
committerIngo Molnar <mingo@kernel.org>2018-06-21 14:22:33 +0200
commitade5ef9280c33993099199c51e2e27c2c4013afd (patch)
tree7a3d8c1a0413817dc82e83a5fbbc1c41c4438f9d /lib/atomic64.c
parentf74445b6dd6b8f33ed34e005d19ecbb49171dabf (diff)
downloadlinux-ade5ef9280c33993099199c51e2e27c2c4013afd.tar.bz2
atomics: Make conditional ops return 'bool'
Some of the atomics return a status value, which is a boolean value describing whether the operation was performed. To make it clear that this is a boolean value, let's update the common fallbacks to return bool, fixing up the return values and comments likewise. At the same time, let's simplify the description of the operations in their respective comments. The instrumented atomics and generic atomic64 implementation are updated accordingly. Note that atomic64_dec_if_positive() doesn't follow the usual test op pattern, and returns the would-be decremented value. This is not changed. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Will Deacon <will.deacon@arm.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/lkml/20180621121321.4761-5-mark.rutland@arm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'lib/atomic64.c')
-rw-r--r--lib/atomic64.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/atomic64.c b/lib/atomic64.c
index 53c2d5edc826..4230f4b8906c 100644
--- a/lib/atomic64.c
+++ b/lib/atomic64.c
@@ -178,16 +178,16 @@ long long atomic64_xchg(atomic64_t *v, long long new)
}
EXPORT_SYMBOL(atomic64_xchg);
-int atomic64_add_unless(atomic64_t *v, long long a, long long u)
+bool atomic64_add_unless(atomic64_t *v, long long a, long long u)
{
unsigned long flags;
raw_spinlock_t *lock = lock_addr(v);
- int ret = 0;
+ bool ret = false;
raw_spin_lock_irqsave(lock, flags);
if (v->counter != u) {
v->counter += a;
- ret = 1;
+ ret = true;
}
raw_spin_unlock_irqrestore(lock, flags);
return ret;