diff options
Diffstat (limited to 'include/asm-generic/atomic.h')
-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) | |||
157 | raw_local_irq_restore(flags); | 157 | raw_local_irq_restore(flags); |
158 | } | 158 | } |
159 | 159 | ||
160 | /** | ||
161 | * atomic_set_mask - Atomically set bits in atomic variable | ||
162 | * @mask: Mask of the bits to be set | ||
163 | * @v: pointer of type atomic_t | ||
164 | * | ||
165 | * Atomically sets the bits set in @mask in @v | ||
166 | */ | ||
167 | static inline void atomic_set_mask(unsigned int mask, atomic_t *v) | ||
168 | { | ||
169 | unsigned long flags; | ||
170 | |||
171 | raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */ | ||
172 | v->counter |= mask; | ||
173 | raw_local_irq_restore(flags); | ||
174 | } | ||
175 | |||
160 | /* Assume that atomic operations are already serializing */ | 176 | /* Assume that atomic operations are already serializing */ |
161 | #define smp_mb__before_atomic_dec() barrier() | 177 | #define smp_mb__before_atomic_dec() barrier() |
162 | #define smp_mb__after_atomic_dec() barrier() | 178 | #define smp_mb__after_atomic_dec() barrier() |