Skip to content

Commit

Permalink
asm-generic: move cmpxchg*_local defs to cmpxchg.h
Browse files Browse the repository at this point in the history
asm/cmpxchg.h can be included on its own and needs to be self-consistent.
The definitions for the cmpxchg*_local macros, as such, need to be part
of this file.

This fixes a build issue on OpenRISC since the system.h smashing patch
96f951e that introdued the direct inclusion
asm/cmpxchg.h into linux/llist.h.

CC: David Howells <[email protected]>
Signed-off-by: Jonas Bonn <[email protected]>
Acked-by: Arnd Bergmann <[email protected]>
  • Loading branch information
Jonas Bonn committed Mar 13, 2013
1 parent d4cb776 commit 00c30e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 0 additions & 6 deletions include/asm-generic/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,6 @@ static inline void atomic_dec(atomic_t *v)
#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v)))
#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))

#define cmpxchg_local(ptr, o, n) \
((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
(unsigned long)(n), sizeof(*(ptr))))

#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))

static inline int __atomic_add_unless(atomic_t *v, int a, int u)
{
int c, old;
Expand Down
10 changes: 10 additions & 0 deletions include/asm-generic/cmpxchg.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
*/
#include <asm-generic/cmpxchg-local.h>

#ifndef cmpxchg_local
#define cmpxchg_local(ptr, o, n) \
((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
(unsigned long)(n), sizeof(*(ptr))))
#endif

#ifndef cmpxchg64_local
#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
#endif

#define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n))
#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))

Expand Down

0 comments on commit 00c30e0

Please sign in to comment.