diff options
| author | 2016-04-11 09:30:50 -0700 | |
|---|---|---|
| committer | 2016-04-11 09:30:50 -0700 | |
| commit | 5f47992491ffe2d5b2b4ea3556bc0f3c0ec9bc8b (patch) | |
| tree | f43f81ab67d152c148bd3dfc1a0683d2c8306014 /include/linux/atomic.h | |
| parent | staging: vme: fix bare use of 'unsigned' (diff) | |
| parent | Linux 4.6-rc3 (diff) | |
Merge 4.6-rc3 into staging-next
This resolves a lot of merge issues with PAGE_CACHE_* changes, and an
iio driver merge issue.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/atomic.h')
| -rw-r--r-- | include/linux/atomic.h | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/include/linux/atomic.h b/include/linux/atomic.h index df4f369254c0..506c3531832e 100644 --- a/include/linux/atomic.h +++ b/include/linux/atomic.h @@ -559,25 +559,25 @@ static inline int atomic_dec_if_positive(atomic_t *v) #endif /** - * fetch_or - perform *ptr |= mask and return old value of *ptr - * @ptr: pointer to value - * @mask: mask to OR on the value - * - * cmpxchg based fetch_or, macro so it works for different integer types + * atomic_fetch_or - perform *p |= mask and return old value of *p + * @p: pointer to atomic_t + * @mask: mask to OR on the atomic_t */ -#ifndef fetch_or -#define fetch_or(ptr, mask) \ -({ typeof(*(ptr)) __old, __val = *(ptr); \ - for (;;) { \ - __old = cmpxchg((ptr), __val, __val | (mask)); \ - if (__old == __val) \ - break; \ - __val = __old; \ - } \ - __old; \ -}) -#endif +#ifndef atomic_fetch_or +static inline int atomic_fetch_or(atomic_t *p, int mask) +{ + int old, val = atomic_read(p); + + for (;;) { + old = atomic_cmpxchg(p, val, val | mask); + if (old == val) + break; + val = old; + } + return old; +} +#endif #ifdef CONFIG_GENERIC_ATOMIC64 #include <asm-generic/atomic64.h> |
