Skip to content

Commit 90fe651

Browse files
Peter Zijlstraingomolnar
authored andcommitted
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>
1 parent 4bbffe7 commit 90fe651

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

‎include/asm-generic/atomic-long.h‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,23 @@ static inline void atomic_long_dec(atomic_long_t *l)
112112
ATOMIC_LONG_PFX(_dec)(v);
113113
}
114114

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); \
120122
}
121123

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)
125130

126-
ATOMIC_LONG_PFX(_sub)(i, v);
127-
}
131+
#undef ATOMIC_LONG_OP
128132

129133
static inline int atomic_long_sub_and_test(long i, atomic_long_t *l)
130134
{

‎include/linux/atomic.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,6 @@ static inline int atomic_dec_if_positive(atomic_t *v)
451451
}
452452
#endif
453453

454-
#include <asm-generic/atomic-long.h>
455454
#ifdef CONFIG_GENERIC_ATOMIC64
456455
#include <asm-generic/atomic64.h>
457456
#endif
@@ -463,4 +462,6 @@ static inline void atomic64_andnot(long long i, atomic64_t *v)
463462
}
464463
#endif
465464

465+
#include <asm-generic/atomic-long.h>
466+
466467
#endif /* _LINUX_ATOMIC_H */

0 commit comments

Comments
 (0)