Skip to content

Commit 71a2ed7

Browse files
committed
lib: fix atomic64_cmpxchg issue on 32bits environment
it caused the undefined symbol of wrong_size_cmpxchg() during a runtime. Signed-off-by: Hajime Tazaki <[email protected]>
1 parent 673ef3c commit 71a2ed7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arch/lib/include/asm/atomic.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ long atomic64_sub_return(long i, atomic64_t *v);
4242
#define atomic64_dec_return(v) (atomic64_sub_return(1, (v)))
4343
static inline long atomic64_cmpxchg(atomic64_t *v, long old, long new)
4444
{
45-
return cmpxchg(&v->counter, old, new);
45+
long long val;
46+
47+
val = v->counter;
48+
if (val == old)
49+
v->counter = new;
50+
return val;
4651
}
4752
long atomic64_xchg(atomic64_t *v, long new);
4853
int atomic64_add_unless(atomic64_t *v, long a, long u);

0 commit comments

Comments
 (0)