]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
atomic: Collapse all atomic_{set,clear}_mask definitions
authorPeter Zijlstra <peterz@infradead.org>
Thu, 23 Apr 2015 23:12:32 +0000 (01:12 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 27 Jul 2015 12:06:24 +0000 (14:06 +0200)
Move the now generic definitions of atomic_{set,clear}_mask() into
linux/atomic.h to avoid endless and pointless repetition.

Also, provide an atomic_andnot() wrapper for those few archs that can
implement that.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 files changed:
arch/arc/include/asm/atomic.h
arch/blackfin/include/asm/atomic.h
arch/frv/include/asm/atomic.h
arch/h8300/include/asm/atomic.h
arch/m32r/include/asm/atomic.h
arch/m68k/include/asm/atomic.h
arch/metag/include/asm/atomic_lnkget.h
arch/metag/include/asm/atomic_lock1.h
arch/mn10300/include/asm/atomic.h
arch/powerpc/kernel/misc_32.S
arch/s390/include/asm/atomic.h
arch/sh/include/asm/atomic.h
arch/x86/include/asm/atomic.h
arch/xtensa/include/asm/atomic.h
include/asm-generic/atomic.h
include/linux/atomic.h

index 2a847821dee1a9a456378a209478d6bd089456a7..d8a85e706fba332f82b84febf040ec46205b941f 100644 (file)
@@ -155,16 +155,6 @@ ATOMIC_OP(xor, ^=, xor)
 #undef ATOMIC_OP_RETURN
 #undef ATOMIC_OP
 
-static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_and(~mask, v);
-}
-
-static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_or(mask, v);
-}
-
 /**
  * __atomic_add_unless - add unless the number is a given value
  * @v: pointer of type atomic_t
index 2d6a7a3823c3cf269490e7711b90685c9d290e40..1c1c42330c99c9e432991429778625be6e5235df 100644 (file)
@@ -32,16 +32,6 @@ asmlinkage int __raw_atomic_test_asm(const volatile int *ptr, int value);
 #define atomic_and(i, v) (void)__raw_atomic_and_asm(&(v)->counter, i)
 #define atomic_xor(i, v) (void)__raw_atomic_xor_asm(&(v)->counter, i)
 
-static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_and(~mask, v);
-}
-
-static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_or(mask, v);
-}
-
 #endif
 
 #include <asm-generic/atomic.h>
index fc48bea26b402596dbfe70fe74cfc8920914fac4..0da689def4cc66feec44f0e84e7be1c7c095817b 100644 (file)
@@ -198,14 +198,4 @@ ATOMIC_OP(xor)
 
 #undef ATOMIC_OP
 
-static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_and(~mask, v);
-}
-
-static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_or(mask, v);
-}
-
 #endif /* _ASM_ATOMIC_H */
index c4d061f09c44db160b9ac0437be5a79e0d0d1dca..702ee539f87da5e0e397d091a9bd56218c4173d4 100644 (file)
@@ -89,14 +89,4 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u)
        return ret;
 }
 
-static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_and(~mask, v);
-}
-
-static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_or(mask, v);
-}
-
 #endif /* __ARCH_H8300_ATOMIC __ */
index b2a13fbd5be0ea14933f3c4e0c65abb3a306c41c..025e2a1704936250bb0403f619f70f4897826304 100644 (file)
@@ -243,15 +243,4 @@ static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
        return c;
 }
 
-
-static __inline__ __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_and(~mask, v);
-}
-
-static __inline__ __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_or(mask, v);
-}
-
 #endif /* _ASM_M32R_ATOMIC_H */
index 93ebd96aa494b2f10e6701012530e32db6bbc128..039fac120cc0ebe31d39264ea985961e184aaf3e 100644 (file)
@@ -174,16 +174,6 @@ static inline int atomic_add_negative(int i, atomic_t *v)
        return c != 0;
 }
 
-static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_and(~mask, v);
-}
-
-static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_or(mask, v);
-}
-
 static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
 {
        int c, old;
index 0642606de9012f7a30fc292adb433f69504f174f..21c4c268b86c6e87ce0342487b3ab4ebad618d59 100644 (file)
@@ -82,16 +82,6 @@ ATOMIC_OP(xor)
 #undef ATOMIC_OP_RETURN
 #undef ATOMIC_OP
 
-static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_and(~mask, v);
-}
-
-static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_or(mask, v);
-}
-
 static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
 {
        int result, temp;
index 7d88725a85da46bea0eed2db9ffa224391f603f3..f8efe380fe8b334ef87cb91e905a52bfa1da2b48 100644 (file)
@@ -76,16 +76,6 @@ ATOMIC_OP(xor, ^=)
 #undef ATOMIC_OP_RETURN
 #undef ATOMIC_OP
 
-static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_and(~mask, v);
-}
-
-static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_or(mask, v);
-}
-
 static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
 {
        int ret;
index f5a63f0bda46203e5e024ffc40bc3da1c936cd73..375e59140c9cef2f8f9fe36962ac3ddca399d994 100644 (file)
@@ -131,30 +131,6 @@ static inline void atomic_dec(atomic_t *v)
 #define atomic_xchg(ptr, v)            (xchg(&(ptr)->counter, (v)))
 #define atomic_cmpxchg(v, old, new)    (cmpxchg(&((v)->counter), (old), (new)))
 
-/**
- * atomic_clear_mask - Atomically clear bits in memory
- * @mask: Mask of the bits to be cleared
- * @v: pointer to word in memory
- *
- * Atomically clears the bits set in mask from the memory word specified.
- */
-static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_and(~mask, v);
-}
-
-/**
- * atomic_set_mask - Atomically set bits in memory
- * @mask: Mask of the bits to be set
- * @v: pointer to word in memory
- *
- * Atomically sets the bits set in mask from the memory word specified.
- */
-static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_or(mask, v);
-}
-
 #endif /* __KERNEL__ */
 #endif /* CONFIG_SMP */
 #endif /* _ASM_ATOMIC_H */
index 7c6bb4b17b4960d111f29bc7f37632f9026d944c..ed3ab509facac91ebe8625570d9f15c203b45f20 100644 (file)
@@ -595,25 +595,6 @@ _GLOBAL(copy_page)
        li      r11,4
        b       2b
 
-/*
- * void atomic_clear_mask(atomic_t mask, atomic_t *addr)
- * void atomic_set_mask(atomic_t mask, atomic_t *addr);
- */
-_GLOBAL(atomic_clear_mask)
-10:    lwarx   r5,0,r4
-       andc    r5,r5,r3
-       PPC405_ERR77(0,r4)
-       stwcx.  r5,0,r4
-       bne-    10b
-       blr
-_GLOBAL(atomic_set_mask)
-10:    lwarx   r5,0,r4
-       or      r5,r5,r3
-       PPC405_ERR77(0,r4)
-       stwcx.  r5,0,r4
-       bne-    10b
-       blr
-
 /*
  * Extended precision shifts.
  *
index d761aeff72da0805542f2cc65b150e8e545f5415..117fa5c921c1b035ad8c4a60cc8774cc5022778f 100644 (file)
@@ -132,16 +132,6 @@ ATOMIC_OP(xor, XOR)
 
 #undef ATOMIC_OP
 
-static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_and(~mask, v);
-}
-
-static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_or(mask, v);
-}
-
 #define atomic_xchg(v, new) (xchg(&((v)->counter), new))
 
 static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
index cee0245257e13dec5cbd814567005e902b1ca6bc..05b9f74ce2d544d3f9d7bede26cdc57c04a54e2c 100644 (file)
 #include <asm/atomic-irq.h>
 #endif
 
-static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_and(~mask, v);
-}
-
-static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_or(mask, v);
-}
-
 #define atomic_add_negative(a, v)      (atomic_add_return((a), (v)) < 0)
 #define atomic_dec_return(v)           atomic_sub_return(1, (v))
 #define atomic_inc_return(v)           atomic_add_return(1, (v))
index b3493023efdae0ba23784347ae17ebd5a4ae6cb5..fb52aa644aabb4ed8ff15eb26dca1944648786c0 100644 (file)
@@ -234,16 +234,6 @@ static __always_inline short int atomic_inc_short(short int *v)
        return *v;
 }
 
-static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_and(~mask, v);
-}
-
-static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_or(mask, v);
-}
-
 #ifdef CONFIG_X86_32
 # include <asm/atomic64_32.h>
 #else
index 31371f43c23bbdd9d054d84fe561367ba12d983f..e0be67936990277cad0e580cdf9714871893fb45 100644 (file)
@@ -153,16 +153,6 @@ ATOMIC_OP(xor)
 #undef ATOMIC_OP_RETURN
 #undef ATOMIC_OP
 
-static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_or(mask, v);
-}
-
-static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_and(~mask, v);
-}
-
 /**
  * atomic_sub_and_test - subtract value from variable and test result
  * @i: integer value to subtract
index a41b0b8f74049df6f59cbdabd0154f93d02568ce..d4d7e337fdcb5d7bda73656c1e8b66fee6ff2cc3 100644 (file)
@@ -113,16 +113,6 @@ ATOMIC_OP(xor, ^)
 #undef ATOMIC_OP_RETURN
 #undef ATOMIC_OP
 
-static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_and(~mask, v);
-}
-
-static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
-{
-       atomic_or(mask, v);
-}
-
 /*
  * Atomic operations that C can't guarantee us.  Useful for
  * resource counting etc..
index 7d6279012a1fdab2d6c87611b2cc86340caa93d5..8b98b423388fad55263cbab6683217bb7914d851 100644 (file)
@@ -28,6 +28,23 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
 #define atomic_inc_not_zero(v)         atomic_add_unless((v), 1, 0)
 #endif
 
+#ifndef atomic_andnot
+static inline void atomic_andnot(int i, atomic_t *v)
+{
+       atomic_and(~i, v);
+}
+#endif
+
+static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
+{
+       atomic_andnot(mask, v);
+}
+
+static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
+{
+       atomic_or(mask, v);
+}
+
 /**
  * atomic_inc_not_zero_hint - increment if not null
  * @v: pointer of type atomic_t
@@ -115,4 +132,12 @@ static inline int atomic_dec_if_positive(atomic_t *v)
 #ifdef CONFIG_GENERIC_ATOMIC64
 #include <asm-generic/atomic64.h>
 #endif
+
+#ifndef atomic64_andnot
+static inline void atomic64_andnot(long long i, atomic64_t *v)
+{
+       atomic64_and(~i, v);
+}
+#endif
+
 #endif /* _LINUX_ATOMIC_H */