Skip to content

Commit 40c60ac

Browse files
committed
Merge branch 'parisc-5.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux into master
Pull parisc fixes from Helge Deller: "Two fixes: - Add the cmpxchg() function for pointers to u8 values. This fixes a kernel linking error when building the tusb1210 driver (from Liam Beguin). - Add a define for atomic64_set_release() to fix CPU soft lockups which happen because of missing unlocks while processing bit operations (from John David Anglin)" * 'parisc-5.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: Add atomic64_set_release() define to avoid CPU soft lockups parisc: add support for cmpxchg on u8 pointers
2 parents 1ada901 + be6577a commit 40c60ac

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

arch/parisc/include/asm/atomic.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ atomic64_set(atomic64_t *v, s64 i)
212212
_atomic_spin_unlock_irqrestore(v, flags);
213213
}
214214

215+
#define atomic64_set_release(v, i) atomic64_set((v), (i))
216+
215217
static __inline__ s64
216218
atomic64_read(const atomic64_t *v)
217219
{

arch/parisc/include/asm/cmpxchg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ extern void __cmpxchg_called_with_bad_pointer(void);
6060
extern unsigned long __cmpxchg_u32(volatile unsigned int *m, unsigned int old,
6161
unsigned int new_);
6262
extern u64 __cmpxchg_u64(volatile u64 *ptr, u64 old, u64 new_);
63+
extern u8 __cmpxchg_u8(volatile u8 *ptr, u8 old, u8 new_);
6364

6465
/* don't worry...optimizer will get rid of most of this */
6566
static inline unsigned long
@@ -71,6 +72,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
7172
#endif
7273
case 4: return __cmpxchg_u32((unsigned int *)ptr,
7374
(unsigned int)old, (unsigned int)new_);
75+
case 1: return __cmpxchg_u8((u8 *)ptr, (u8)old, (u8)new_);
7476
}
7577
__cmpxchg_called_with_bad_pointer();
7678
return old;

arch/parisc/lib/bitops.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,15 @@ unsigned long __cmpxchg_u32(volatile unsigned int *ptr, unsigned int old, unsign
7979
_atomic_spin_unlock_irqrestore(ptr, flags);
8080
return (unsigned long)prev;
8181
}
82+
83+
u8 __cmpxchg_u8(volatile u8 *ptr, u8 old, u8 new)
84+
{
85+
unsigned long flags;
86+
u8 prev;
87+
88+
_atomic_spin_lock_irqsave(ptr, flags);
89+
if ((prev = *ptr) == old)
90+
*ptr = new;
91+
_atomic_spin_unlock_irqrestore(ptr, flags);
92+
return prev;
93+
}

0 commit comments

Comments
 (0)