Commit c6691126 authored by Mathieu Lacage's avatar Mathieu Lacage Committed by Arnd Bergmann

asm-generic: cmpxchg does not handle non-long arguments

The version of cmpxchg defined in asm-generic/system.h does not handle
correctly non-long arguments. Use the version defined in cmpxchg.h
instead.
Signed-off-by: default avatarMathieu Lacage <mathieu.lacage@inria.fr>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 8b9d4069
......@@ -21,6 +21,7 @@
#include <linux/irqflags.h>
#include <asm/cmpxchg-local.h>
#include <asm/cmpxchg.h>
struct task_struct;
......@@ -136,25 +137,6 @@ unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
#define xchg(ptr, x) \
((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
static inline unsigned long __cmpxchg(volatile unsigned long *m,
unsigned long old, unsigned long new)
{
unsigned long retval;
unsigned long flags;
local_irq_save(flags);
retval = *m;
if (retval == old)
*m = new;
local_irq_restore(flags);
return retval;
}
#define cmpxchg(ptr, o, n) \
((__typeof__(*(ptr))) __cmpxchg((unsigned long *)(ptr), \
(unsigned long)(o), \
(unsigned long)(n)))
#endif /* !__ASSEMBLY__ */
#endif /* __KERNEL__ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment