summaryrefslogtreecommitdiff
path: root/arch/parisc/lib/bitops.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2020-07-26 12:14:46 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-07-26 12:14:46 -0700
commit40c60ac32174f0c0c090cd31d0d1712f2478e689 (patch)
tree082e765c485880d42e64f3c4aa0c6e637beb269e /arch/parisc/lib/bitops.c
parent1ada9010e578150984039a770c98f41799b30bc4 (diff)
parentbe6577af0cef934ccb036445314072e8cb9217b9 (diff)
downloadlinux-40c60ac32174f0c0c090cd31d0d1712f2478e689.tar.gz
linux-40c60ac32174f0c0c090cd31d0d1712f2478e689.tar.bz2
linux-40c60ac32174f0c0c090cd31d0d1712f2478e689.zip
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
Diffstat (limited to 'arch/parisc/lib/bitops.c')
-rw-r--r--arch/parisc/lib/bitops.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/parisc/lib/bitops.c b/arch/parisc/lib/bitops.c
index 70ffbcf889b8..2e4d1f05a926 100644
--- a/arch/parisc/lib/bitops.c
+++ b/arch/parisc/lib/bitops.c
@@ -79,3 +79,15 @@ unsigned long __cmpxchg_u32(volatile unsigned int *ptr, unsigned int old, unsign
_atomic_spin_unlock_irqrestore(ptr, flags);
return (unsigned long)prev;
}
+
+u8 __cmpxchg_u8(volatile u8 *ptr, u8 old, u8 new)
+{
+ unsigned long flags;
+ u8 prev;
+
+ _atomic_spin_lock_irqsave(ptr, flags);
+ if ((prev = *ptr) == old)
+ *ptr = new;
+ _atomic_spin_unlock_irqrestore(ptr, flags);
+ return prev;
+}