Commit c6691126636769bd22bfd7b55829f0373a93c1ce
Committed by
Arnd Bergmann
1 parent
8b9d40691e
Exists in
master
and in
7 other branches
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: Mathieu Lacage <mathieu.lacage@inria.fr> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Showing 1 changed file with 1 additions and 19 deletions Side-by-side Diff
include/asm-generic/system.h
... | ... | @@ -21,6 +21,7 @@ |
21 | 21 | #include <linux/irqflags.h> |
22 | 22 | |
23 | 23 | #include <asm/cmpxchg-local.h> |
24 | +#include <asm/cmpxchg.h> | |
24 | 25 | |
25 | 26 | struct task_struct; |
26 | 27 | |
... | ... | @@ -135,25 +136,6 @@ |
135 | 136 | |
136 | 137 | #define xchg(ptr, x) \ |
137 | 138 | ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) |
138 | - | |
139 | -static inline unsigned long __cmpxchg(volatile unsigned long *m, | |
140 | - unsigned long old, unsigned long new) | |
141 | -{ | |
142 | - unsigned long retval; | |
143 | - unsigned long flags; | |
144 | - | |
145 | - local_irq_save(flags); | |
146 | - retval = *m; | |
147 | - if (retval == old) | |
148 | - *m = new; | |
149 | - local_irq_restore(flags); | |
150 | - return retval; | |
151 | -} | |
152 | - | |
153 | -#define cmpxchg(ptr, o, n) \ | |
154 | - ((__typeof__(*(ptr))) __cmpxchg((unsigned long *)(ptr), \ | |
155 | - (unsigned long)(o), \ | |
156 | - (unsigned long)(n))) | |
157 | 139 | |
158 | 140 | #endif /* !__ASSEMBLY__ */ |
159 | 141 |