Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

atomic: Add atomic_long_t bitops

When adding the atomic bitops, I seem to have forgotten about
atomic_long_t, fix this.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Peter Zijlstra and committed by
Ingo Molnar
90fe6514 4bbffe71

+16 -11
+14 -10
include/asm-generic/atomic-long.h
··· 112 112 ATOMIC_LONG_PFX(_dec)(v); 113 113 } 114 114 115 - static inline void atomic_long_add(long i, atomic_long_t *l) 116 - { 117 - ATOMIC_LONG_PFX(_t) *v = (ATOMIC_LONG_PFX(_t) *)l; 118 - 119 - ATOMIC_LONG_PFX(_add)(i, v); 115 + #define ATOMIC_LONG_OP(op) \ 116 + static inline void \ 117 + atomic_long_##op(long i, atomic_long_t *l) \ 118 + { \ 119 + ATOMIC_LONG_PFX(_t) *v = (ATOMIC_LONG_PFX(_t) *)l; \ 120 + \ 121 + ATOMIC_LONG_PFX(_##op)(i, v); \ 120 122 } 121 123 122 - static inline void atomic_long_sub(long i, atomic_long_t *l) 123 - { 124 - ATOMIC_LONG_PFX(_t) *v = (ATOMIC_LONG_PFX(_t) *)l; 124 + ATOMIC_LONG_OP(add) 125 + ATOMIC_LONG_OP(sub) 126 + ATOMIC_LONG_OP(and) 127 + ATOMIC_LONG_OP(or) 128 + ATOMIC_LONG_OP(xor) 129 + ATOMIC_LONG_OP(andnot) 125 130 126 - ATOMIC_LONG_PFX(_sub)(i, v); 127 - } 131 + #undef ATOMIC_LONG_OP 128 132 129 133 static inline int atomic_long_sub_and_test(long i, atomic_long_t *l) 130 134 {
+2 -1
include/linux/atomic.h
··· 451 451 } 452 452 #endif 453 453 454 - #include <asm-generic/atomic-long.h> 455 454 #ifdef CONFIG_GENERIC_ATOMIC64 456 455 #include <asm-generic/atomic64.h> 457 456 #endif ··· 461 462 atomic64_and(~i, v); 462 463 } 463 464 #endif 465 + 466 + #include <asm-generic/atomic-long.h> 464 467 465 468 #endif /* _LINUX_ATOMIC_H */