Skip to content

Commit 673ef3c

Browse files
committed
lib: make atomic64_xx function available
ss command (via tcp_diag.c) uses those atomic functions, which were not defined appropriately in the past. Signed-off-by: Hajime Tazaki <[email protected]>
1 parent 554167e commit 673ef3c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

arch/lib/include/asm/atomic.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define _ASM_SIM_ATOMIC_H
33

44
#include <linux/types.h>
5+
#include <asm-generic/cmpxchg.h>
56

67
#if !defined(CONFIG_64BIT)
78
typedef struct {
@@ -37,9 +38,12 @@ static inline void atomic64_set(atomic64_t *v, long i)
3738
v->counter = i;
3839
}
3940
long atomic64_sub_return(long i, atomic64_t *v);
40-
long atomic64_inc_return(atomic64_t *v);
41-
long atomic64_dec_return(atomic64_t *v);
42-
long atomic64_cmpxchg(atomic64_t *v, long old, long new);
41+
#define atomic64_inc_return(v) (atomic64_add_return(1, (v)))
42+
#define atomic64_dec_return(v) (atomic64_sub_return(1, (v)))
43+
static inline long atomic64_cmpxchg(atomic64_t *v, long old, long new)
44+
{
45+
return cmpxchg(&v->counter, old, new);
46+
}
4347
long atomic64_xchg(atomic64_t *v, long new);
4448
int atomic64_add_unless(atomic64_t *v, long a, long u);
4549
int atomic64_inc_is_not_zero(atomic64_t *v);

0 commit comments

Comments
 (0)