Skip to content

Commit

Permalink
m32r: fix build warning
Browse files Browse the repository at this point in the history
Some m32r builds were having a warning:

  arch/m32r/include/asm/cmpxchg.h:191:3: warning: value computed is not used
  arch/m32r/include/asm/cmpxchg.h:68:3: warning: value computed is not used

Taking the idea from commit e001bba ("ARM: cmpxchg: avoid warnings
from macro-ized cmpxchg() implementations") the m32r implementation is
changed to use a similar construct with a compound expression instead of
a typecast, which causes the compiler to not complain about an unused
result.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Sudip Mukherjee <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
sudipm-mukherjee authored and torvalds committed Feb 23, 2017
1 parent 6408b6f commit af0de78
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions arch/m32r/include/asm/cmpxchg.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ __xchg(unsigned long x, volatile void *ptr, int size)
return (tmp);
}

#define xchg(ptr, x) \
((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
#define xchg(ptr, x) ({ \
((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), \
sizeof(*(ptr)))); \
})

static __always_inline unsigned long
__xchg_local(unsigned long x, volatile void *ptr, int size)
Expand Down Expand Up @@ -187,9 +189,12 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
return old;
}

#define cmpxchg(ptr, o, n) \
((__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)(o), \
(unsigned long)(n), sizeof(*(ptr))))
#define cmpxchg(ptr, o, n) ({ \
((__typeof__(*(ptr))) \
__cmpxchg((ptr), (unsigned long)(o), \
(unsigned long)(n), \
sizeof(*(ptr)))); \
})

#include <asm-generic/cmpxchg-local.h>

Expand Down

0 comments on commit af0de78

Please sign in to comment.