Skip to content

Commit 2f52802

Browse files
Al Viropaulmckrcu
authored andcommitted
sparc32: make __cmpxchg_u32() return u32
Conversion between u32 and unsigned long is tautological there, and the only use of return value is to return it from __cmpxchg() (which return unsigned long). Get rid of explicit casts in __cmpxchg_u32() call, while we are at it - normal conversions for arguments will do just fine. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
1 parent 39cd87c commit 2f52802

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

arch/sparc/include/asm/cmpxchg_32.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ static __always_inline unsigned long __arch_xchg(unsigned long x, __volatile__ v
3939
/* bug catcher for when unsupported size is used - won't link */
4040
void __cmpxchg_called_with_bad_pointer(void);
4141
/* we only need to support cmpxchg of a u32 on sparc */
42-
unsigned long __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_);
42+
u32 __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_);
4343

4444
/* don't worry...optimizer will get rid of most of this */
4545
static inline unsigned long
4646
__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
4747
{
4848
switch (size) {
4949
case 4:
50-
return __cmpxchg_u32((u32 *)ptr, (u32)old, (u32)new_);
50+
return __cmpxchg_u32(ptr, old, new_);
5151
default:
5252
__cmpxchg_called_with_bad_pointer();
5353
break;

arch/sparc/lib/atomic32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ unsigned long sp32___change_bit(unsigned long *addr, unsigned long mask)
159159
}
160160
EXPORT_SYMBOL(sp32___change_bit);
161161

162-
unsigned long __cmpxchg_u32(volatile u32 *ptr, u32 old, u32 new)
162+
u32 __cmpxchg_u32(volatile u32 *ptr, u32 old, u32 new)
163163
{
164164
unsigned long flags;
165165
u32 prev;
@@ -169,7 +169,7 @@ unsigned long __cmpxchg_u32(volatile u32 *ptr, u32 old, u32 new)
169169
*ptr = new;
170170
spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
171171

172-
return (unsigned long)prev;
172+
return prev;
173173
}
174174
EXPORT_SYMBOL(__cmpxchg_u32);
175175

0 commit comments

Comments
 (0)