]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - include/asm-parisc/atomic.h
SPIN_LOCK_UNLOCKED cleanup in init_task.h
[mirror_ubuntu-bionic-kernel.git] / include / asm-parisc / atomic.h
index 4dc7253ff5d06a2e80a44388996b31bd8ce9019c..7d57d34fcca8a969e520e4817b04cfe641506857 100644 (file)
@@ -5,7 +5,6 @@
 #ifndef _ASM_PARISC_ATOMIC_H_
 #define _ASM_PARISC_ATOMIC_H_
 
-#include <linux/config.h>
 #include <linux/types.h>
 #include <asm/system.h>
 
@@ -59,7 +58,7 @@ extern void __xchg_called_with_bad_pointer(void);
 /* __xchg32/64 defined in arch/parisc/lib/bitops.c */
 extern unsigned long __xchg8(char, char *);
 extern unsigned long __xchg32(int, int *);
-#ifdef __LP64__
+#ifdef CONFIG_64BIT
 extern unsigned long __xchg64(unsigned long, unsigned long *);
 #endif
 
@@ -68,7 +67,7 @@ static __inline__ unsigned long
 __xchg(unsigned long x, __volatile__ void * ptr, int size)
 {
        switch(size) {
-#ifdef __LP64__
+#ifdef CONFIG_64BIT
        case 8: return __xchg64(x,(unsigned long *) ptr);
 #endif
        case 4: return __xchg32((int) x, (int *) ptr);
@@ -82,7 +81,7 @@ __xchg(unsigned long x, __volatile__ void * ptr, int size)
 /*
 ** REVISIT - Abandoned use of LDCW in xchg() for now:
 ** o need to test sizeof(*ptr) to avoid clearing adjacent bytes
-** o and while we are at it, could __LP64__ code use LDCD too?
+** o and while we are at it, could CONFIG_64BIT code use LDCD too?
 **
 **     if (__builtin_constant_p(x) && (x == NULL))
 **             if (((unsigned long)p & 0xf) == 0)
@@ -106,7 +105,7 @@ static __inline__ unsigned long
 __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
 {
        switch(size) {
-#ifdef __LP64__
+#ifdef CONFIG_64BIT
        case 8: return __cmpxchg_u64((unsigned long *)ptr, old, new_);
 #endif
        case 4: return __cmpxchg_u32((unsigned int *)ptr, (unsigned int) old, (unsigned int) new_);
@@ -210,6 +209,8 @@ static __inline__ int atomic_read(const atomic_t *v)
 
 #define atomic_dec_and_test(v) (atomic_dec_return(v) == 0)
 
+#define atomic_sub_and_test(i,v)       (atomic_sub_return((i),(v)) == 0)
+
 #define ATOMIC_INIT(i) ((atomic_t) { (i) })
 
 #define smp_mb__before_atomic_dec()    smp_mb()
@@ -217,7 +218,7 @@ static __inline__ int atomic_read(const atomic_t *v)
 #define smp_mb__before_atomic_inc()    smp_mb()
 #define smp_mb__after_atomic_inc()     smp_mb()
 
-#ifdef __LP64__
+#ifdef CONFIG_64BIT
 
 typedef struct { volatile s64 counter; } atomic64_t;
 
@@ -267,8 +268,9 @@ atomic64_read(const atomic64_t *v)
 
 #define atomic64_inc_and_test(v)       (atomic64_inc_return(v) == 0)
 #define atomic64_dec_and_test(v)       (atomic64_dec_return(v) == 0)
+#define atomic64_sub_and_test(i,v)     (atomic64_sub_return((i),(v)) == 0)
 
-#endif /* __LP64__ */
+#endif /* CONFIG_64BIT */
 
 #include <asm-generic/atomic.h>