[PATCH v2 2/2] ARM: include: asm: use 'int' instead of 'unsigned long' for 'oldval' in atomic_cmpxchg().

Chen Gang gang.chen at asianux.com
Tue Oct 8 06:59:15 EDT 2013


For atomic_cmpxchg(), the type of 'oldval' need be 'int' to match the
type of "*ptr" (used by 'ldrex' instruction) and 'old' (used by 'teq'
instruction).

Signed-off-by: Chen Gang <gang.chen at asianux.com>
---
 arch/arm/include/asm/atomic.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
index a715ac0..9ee7e01 100644
--- a/arch/arm/include/asm/atomic.h
+++ b/arch/arm/include/asm/atomic.h
@@ -114,7 +114,8 @@ static inline int atomic_sub_return(int i, atomic_t *v)
 
 static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new)
 {
-	unsigned long oldval, res;
+	int oldval;
+	unsigned long res;
 
 	smp_mb();
 
-- 
1.7.7.6



More information about the linux-arm-kernel mailing list