diff options
author | Paul E. McKenney <paul.mckenney@linaro.org> | 2011-05-11 05:33:33 -0700 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-05-28 17:41:46 +0200 |
commit | 55c2945aa9d4d907ec5ca4f6a4e30ae908d8d30d (patch) | |
tree | e9cb0d05634fe214788dc6c07e2decf69cde98e3 /include/linux | |
parent | 29f742f88a32c9ab8cf6d9ba69e1ea918be5aa58 (diff) |
atomic: Add atomic_or()
An atomic_or() function is needed by TREE_RCU to avoid deadlock, so
add a generic version.
Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/atomic.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/atomic.h b/include/linux/atomic.h index 96c038e43d6..ee456c79b0e 100644 --- a/include/linux/atomic.h +++ b/include/linux/atomic.h @@ -34,4 +34,17 @@ static inline int atomic_inc_not_zero_hint(atomic_t *v, int hint) } #endif +#ifndef CONFIG_ARCH_HAS_ATOMIC_OR +static inline void atomic_or(int i, atomic_t *v) +{ + int old; + int new; + + do { + old = atomic_read(v); + new = old | i; + } while (atomic_cmpxchg(v, old, new) != old); +} +#endif /* #ifndef CONFIG_ARCH_HAS_ATOMIC_OR */ + #endif /* _LINUX_ATOMIC_H */ |