[v5,01/21] arch, ppc64: Add missing atomic_dec_and_test helper

Submitted by Cyrill Gorcunov on May 10, 2018, 2:57 p.m.

Details

Message ID 20180510145801.12322-2-gorcunov@gmail.com
State New
Series "Add support of deleted unix sockets"
Headers show

Commit Message

Cyrill Gorcunov May 10, 2018, 2:57 p.m.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 include/common/arch/ppc64/asm/atomic.h | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/include/common/arch/ppc64/asm/atomic.h b/include/common/arch/ppc64/asm/atomic.h
index 35440399605c..461875c6ea1b 100644
--- a/include/common/arch/ppc64/asm/atomic.h
+++ b/include/common/arch/ppc64/asm/atomic.h
@@ -125,6 +125,8 @@  static __inline__ int atomic_sub_return(int a, atomic_t *v)
 	return t;
 }
 
+/* true if the result is 0, or false for all other cases. */
+#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0)
 #define atomic_dec_return(v)  (atomic_sub_return(1, v))
 
 #define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))