diff options
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) | |||
559 | #endif | 559 | #endif |
560 | 560 | ||
561 | /** | 561 | /** |
562 | * fetch_or - perform *ptr |= mask and return old value of *ptr | 562 | * atomic_fetch_or - perform *p |= mask and return old value of *p |
563 | * @ptr: pointer to value | 563 | * @p: pointer to atomic_t |
564 | * @mask: mask to OR on the value | 564 | * @mask: mask to OR on the atomic_t |
565 | * | ||
566 | * cmpxchg based fetch_or, macro so it works for different integer types | ||
567 | */ | 565 | */ |
568 | #ifndef fetch_or | 566 | #ifndef atomic_fetch_or |
569 | #define fetch_or(ptr, mask) \ | 567 | static inline int atomic_fetch_or(atomic_t *p, int mask) |
570 | ({ typeof(*(ptr)) __old, __val = *(ptr); \ | 568 | { |
571 | for (;;) { \ | 569 | int old, val = atomic_read(p); |
572 | __old = cmpxchg((ptr), __val, __val | (mask)); \ | 570 | |
573 | if (__old == __val) \ | 571 | for (;;) { |
574 | break; \ | 572 | old = atomic_cmpxchg(p, val, val | mask); |
575 | __val = __old; \ | 573 | if (old == val) |
576 | } \ | 574 | break; |
577 | __old; \ | 575 | val = old; |
578 | }) | 576 | } |
579 | #endif | ||
580 | 577 | ||
578 | return old; | ||
579 | } | ||
580 | #endif | ||
581 | 581 | ||
582 | #ifdef CONFIG_GENERIC_ATOMIC64 | 582 | #ifdef CONFIG_GENERIC_ATOMIC64 |
583 | #include <asm-generic/atomic64.h> | 583 | #include <asm-generic/atomic64.h> |