From 7fdbfba40a7fa96cd9b90f4d94141200f6eeceee Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 27 Apr 2016 03:26:00 +0300 Subject: [PATCH] zdtm/atomic: atomic_inc should return the old value 00:24:30.269: 44: ERR: test.c:208: Test exited on unexpected signal It's a correct name for this function. For example, we use this name here criu/arch/ppc64/include/asm/atomic.h And you can find the same set of functions here: test/zdtm/lib/arch/aarch64/include/asm/atomic.h I think this code is more readable (understandable) than just return t - 1. Signed-off-by: Andrew Vagin Signed-off-by: Pavel Emelyanov --- test/zdtm/lib/arch/ppc64/include/asm/atomic.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/zdtm/lib/arch/ppc64/include/asm/atomic.h b/test/zdtm/lib/arch/ppc64/include/asm/atomic.h index 94630062f..bd14cc059 100644 --- a/test/zdtm/lib/arch/ppc64/include/asm/atomic.h +++ b/test/zdtm/lib/arch/ppc64/include/asm/atomic.h @@ -47,7 +47,7 @@ ATOMIC_OP(sub, subf) #undef ATOMIC_OP -static __inline__ int atomic_inc(atomic_t *v) +static __inline__ int atomic_inc_return(atomic_t *v) { int t; @@ -65,6 +65,11 @@ static __inline__ int atomic_inc(atomic_t *v) return t; } +static __inline__ int atomic_inc(atomic_t *v) +{ + return atomic_inc_return(v) - 1; +} + static __inline__ void atomic_dec(atomic_t *v) { int t;