Commit 56cb0f8b authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

arm: atomic -- Add atomic_read/atomic_set helpers

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent aea8a605
...@@ -18,9 +18,17 @@ typedef struct { ...@@ -18,9 +18,17 @@ typedef struct {
#endif #endif
static inline int atomic_read(const atomic_t *v)
{
return (*(volatile int *)&(v)->counter);
}
static inline void atomic_set(atomic_t *v, int i)
{
v->counter = i;
}
#define atomic_set(mem,v) ((mem)->counter = (v)) #define atomic_get atomic_read
#define atomic_get(v) (*(volatile int *)&(v)->counter)
static inline int atomic_add_return(int i, atomic_t *v) static inline int atomic_add_return(int i, atomic_t *v)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment