From 56cb0f8bafb03ae14d6abf3083f2ce3d8c0caeb9 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Fri, 16 Aug 2013 19:31:56 +0400 Subject: [PATCH] arm: atomic -- Add atomic_read/atomic_set helpers Signed-off-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov --- arch/arm/include/asm/atomic.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h index f4651a2fd..7bee004da 100644 --- a/arch/arm/include/asm/atomic.h +++ b/arch/arm/include/asm/atomic.h @@ -18,9 +18,17 @@ typedef struct { #endif +static inline int atomic_read(const atomic_t *v) +{ + return (*(volatile int *)&(v)->counter); +} -#define atomic_set(mem,v) ((mem)->counter = (v)) -#define atomic_get(v) (*(volatile int *)&(v)->counter) +static inline void atomic_set(atomic_t *v, int i) +{ + v->counter = i; +} + +#define atomic_get atomic_read static inline int atomic_add_return(int i, atomic_t *v) {