diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-07-26 16:09:10 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 16:49:48 -0700 |
commit | 00b3c28bd753afb46fb26b2f9e21dd27dacd80d4 (patch) | |
tree | 461b90948bd8dbd31a1752071c9d0a5cc1412185 /include/asm-generic | |
parent | f6081bd3f8152cdd3d857f55631bbb4b72182b82 (diff) | |
download | linux-00b3c28bd753afb46fb26b2f9e21dd27dacd80d4.tar.bz2 |
asm-generic/atomic.h: add atomic_set_mask() helper
Since arches are expected to implement this guy, add a common version for
people the same way as atomic_clear_mask is handled.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Cc: Arun Sharma <asharma@fb.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/atomic.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h index 4e8ecf0693e9..4c56e0daae9f 100644 --- a/include/asm-generic/atomic.h +++ b/include/asm-generic/atomic.h @@ -157,6 +157,22 @@ static inline void atomic_clear_mask(unsigned long mask, atomic_t *v) raw_local_irq_restore(flags); } +/** + * atomic_set_mask - Atomically set bits in atomic variable + * @mask: Mask of the bits to be set + * @v: pointer of type atomic_t + * + * Atomically sets the bits set in @mask in @v + */ +static inline void atomic_set_mask(unsigned int mask, atomic_t *v) +{ + unsigned long flags; + + raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */ + v->counter |= mask; + raw_local_irq_restore(flags); +} + /* Assume that atomic operations are already serializing */ #define smp_mb__before_atomic_dec() barrier() #define smp_mb__after_atomic_dec() barrier() |