Skip to content

Commit d13864b

Browse files
committed
sparc64: Make atomic_xchg() an inline function rather than a macro.
This avoids a lot of -Wunused warnings such as: ==================== kernel/debug/debug_core.c: In function ‘kgdb_cpu_enter’: ./arch/sparc/include/asm/cmpxchg_64.h:55:22: warning: value computed is not used [-Wunused-value] #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) ./arch/sparc/include/asm/atomic_64.h:86:30: note: in expansion of macro ‘xchg’ #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) ^~~~ kernel/debug/debug_core.c:508:4: note: in expansion of macro ‘atomic_xchg’ atomic_xchg(&kgdb_active, cpu); ^~~~~~~~~~~ ==================== Signed-off-by: David S. Miller <[email protected]>
1 parent 49d7006 commit d13864b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arch/sparc/include/asm/atomic_64.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ ATOMIC_OPS(xor)
8383
#define atomic64_add_negative(i, v) (atomic64_add_return(i, v) < 0)
8484

8585
#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
86-
#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
86+
87+
static inline int atomic_xchg(atomic_t *v, int new)
88+
{
89+
return xchg(&v->counter, new);
90+
}
8791

8892
static inline int __atomic_add_unless(atomic_t *v, int a, int u)
8993
{

0 commit comments

Comments
 (0)