atomics/treewide: Rename __atomic_add_unless() => atomic_fetch_add_unless()
authorMark Rutland <mark.rutland@arm.com>
Thu, 21 Jun 2018 12:13:04 +0000 (13:13 +0100)
committerIngo Molnar <mingo@kernel.org>
Thu, 21 Jun 2018 12:22:32 +0000 (14:22 +0200)
While __atomic_add_unless() was originally intended as a building-block
for atomic_add_unless(), it's now used in a number of places around the
kernel. It's the only common atomic operation named __atomic*(), rather
than atomic_*(), and for consistency it would be better named
atomic_fetch_add_unless().

This lack of consistency is slightly confusing, and gets in the way of
scripting atomics. Given that, let's clean things up and promote it to
an official part of the atomics API, in the form of
atomic_fetch_add_unless().

This patch converts definitions and invocations over to the new name,
including the instrumented version, using the following script:

  ----
  git grep -w __atomic_add_unless | while read line; do
  sed -i '{s/\<__atomic_add_unless\>/atomic_fetch_add_unless/}' "${line%%:*}";
  done
  git grep -w __arch_atomic_add_unless | while read line; do
  sed -i '{s/\<__arch_atomic_add_unless\>/arch_atomic_fetch_add_unless/}' "${line%%:*}";
  done
  ----

Note that we do not have atomic{64,_long}_fetch_add_unless(), which will
be introduced by later patches.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Palmer Dabbelt <palmer@sifive.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/lkml/20180621121321.4761-2-mark.rutland@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
31 files changed:
arch/alpha/include/asm/atomic.h
arch/arc/include/asm/atomic.h
arch/arm/include/asm/atomic.h
arch/arm64/include/asm/atomic.h
arch/h8300/include/asm/atomic.h
arch/hexagon/include/asm/atomic.h
arch/ia64/include/asm/atomic.h
arch/m68k/include/asm/atomic.h
arch/mips/include/asm/atomic.h
arch/openrisc/include/asm/atomic.h
arch/parisc/include/asm/atomic.h
arch/powerpc/include/asm/atomic.h
arch/riscv/include/asm/atomic.h
arch/s390/include/asm/atomic.h
arch/sh/include/asm/atomic.h
arch/sparc/include/asm/atomic_32.h
arch/sparc/include/asm/atomic_64.h
arch/sparc/lib/atomic32.c
arch/x86/include/asm/atomic.h
arch/xtensa/include/asm/atomic.h
drivers/block/rbd.c
drivers/infiniband/core/rdma_core.c
fs/afs/rxrpc.c
include/asm-generic/atomic-instrumented.h
include/asm-generic/atomic.h
include/linux/atomic.h
kernel/bpf/syscall.c
net/rxrpc/call_object.c
net/rxrpc/conn_object.c
net/rxrpc/local_object.c
net/rxrpc/peer_object.c

index 767bfdd42992de7fb4084dfecb4caa6c13655129..392b15a4dd4fe6c62943615e1bce6b5bdb2650f5 100644 (file)
@@ -206,7 +206,7 @@ ATOMIC_OPS(xor, xor)
 #define atomic_xchg(v, new) (xchg(&((v)->counter), new))
 
 /**
- * __atomic_add_unless - add unless the number is a given value
+ * atomic_fetch_add_unless - add unless the number is a given value
  * @v: pointer of type atomic_t
  * @a: the amount to add to v...
  * @u: ...unless v is equal to u.
@@ -214,7 +214,7 @@ ATOMIC_OPS(xor, xor)
  * Atomically adds @a to @v, so long as it was not @u.
  * Returns the old value of @v.
  */
-static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
+static __inline__ int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int c, new, old;
        smp_mb();
index 11859287c52af55df317e7a6d3ab9403706bd172..67121b5ff3a36c1783cc5de0f4ca4518ef6fab0e 100644 (file)
@@ -309,7 +309,7 @@ ATOMIC_OPS(xor, ^=, CTOP_INST_AXOR_DI_R2_R2_R3)
 #undef ATOMIC_OP
 
 /**
- * __atomic_add_unless - add unless the number is a given value
+ * atomic_fetch_add_unless - add unless the number is a given value
  * @v: pointer of type atomic_t
  * @a: the amount to add to v...
  * @u: ...unless v is equal to u.
@@ -317,7 +317,7 @@ ATOMIC_OPS(xor, ^=, CTOP_INST_AXOR_DI_R2_R2_R3)
  * Atomically adds @a to @v, so long as it was not @u.
  * Returns the old value of @v
  */
-#define __atomic_add_unless(v, a, u)                                   \
+#define atomic_fetch_add_unless(v, a, u)                                       \
 ({                                                                     \
        int c, old;                                                     \
                                                                        \
index 66d0e215a773cb66d3baaa5a08cbc91056fe00be..9d56d0727c9bf95deb444f96d1285155eea3cd0e 100644 (file)
@@ -130,7 +130,7 @@ static inline int atomic_cmpxchg_relaxed(atomic_t *ptr, int old, int new)
 }
 #define atomic_cmpxchg_relaxed         atomic_cmpxchg_relaxed
 
-static inline int __atomic_add_unless(atomic_t *v, int a, int u)
+static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int oldval, newval;
        unsigned long tmp;
@@ -215,7 +215,7 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
        return ret;
 }
 
-static inline int __atomic_add_unless(atomic_t *v, int a, int u)
+static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int c, old;
 
index c0235e0ff8493fc516109d1e2e5cbaa647fd27dc..264d20339f74bc3761171b72263454d5a9fd2bcb 100644 (file)
 #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_add_negative(i, v)      (atomic_add_return((i), (v)) < 0)
-#define __atomic_add_unless(v, a, u)   ___atomic_add_unless(v, a, u,)
+#define atomic_fetch_add_unless(v, a, u)       ___atomic_add_unless(v, a, u,)
 #define atomic_andnot                  atomic_andnot
 
 /*
index b174dec099bfbf2149f78617ad7176fde06bc59e..5c856887fdf2fe45c0d8943c77d2d53a18f016b2 100644 (file)
@@ -94,7 +94,7 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
        return ret;
 }
 
-static inline int __atomic_add_unless(atomic_t *v, int a, int u)
+static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int ret;
        h8300flags flags;
index fb3dfb2a667ee11626cf9c999e5b303fcc9b9c83..287aa9f394f302d5b2e8f2db22068f2639225e5d 100644 (file)
@@ -164,7 +164,7 @@ ATOMIC_OPS(xor)
 #undef ATOMIC_OP
 
 /**
- * __atomic_add_unless - add unless the number is a given value
+ * atomic_fetch_add_unless - add unless the number is a given value
  * @v: pointer to value
  * @a: amount to add
  * @u: unless value is equal to u
@@ -173,7 +173,7 @@ ATOMIC_OPS(xor)
  *
  */
 
-static inline int __atomic_add_unless(atomic_t *v, int a, int u)
+static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int __oldval;
        register int tmp;
index 2524fb60fbc28518ad7635092ac1bdd5d62114fd..9d2ddde5f9d530d9255d631990104d6e8e45cf64 100644 (file)
@@ -215,7 +215,7 @@ ATOMIC64_FETCH_OP(xor, ^)
        (cmpxchg(&((v)->counter), old, new))
 #define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
 
-static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
+static __inline__ int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int c, old;
        c = atomic_read(v);
index e993e2860ee141ec711a5115ccbee577dad35b58..8022d9ea1213f2117da4ba2e0d26461ddd06e0e0 100644 (file)
@@ -211,7 +211,7 @@ static inline int atomic_add_negative(int i, atomic_t *v)
        return c != 0;
 }
 
-static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
+static __inline__ int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int c, old;
        c = atomic_read(v);
index 0ab176bdb8e8107e3a8b700215ce9a96471b3ee9..02fc1553cf9b24af534dbf5ec6f3d2bde184f30b 100644 (file)
@@ -275,7 +275,7 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
 #define atomic_xchg(v, new) (xchg(&((v)->counter), (new)))
 
 /**
- * __atomic_add_unless - add unless the number is a given value
+ * atomic_fetch_add_unless - add unless the number is a given value
  * @v: pointer of type atomic_t
  * @a: the amount to add to v...
  * @u: ...unless v is equal to u.
@@ -283,7 +283,7 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
  * Atomically adds @a to @v, so long as it was not @u.
  * Returns the old value of @v.
  */
-static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
+static __inline__ int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int c, old;
        c = atomic_read(v);
index 146e1660f00ebc59a43e3ce0b72be6dc62a4a58f..b589fac39b923e7db69ada75f4dfc8e9d9c4aa7b 100644 (file)
@@ -100,7 +100,7 @@ ATOMIC_OP(xor)
  *
  * This is often used through atomic_inc_not_zero()
  */
-static inline int __atomic_add_unless(atomic_t *v, int a, int u)
+static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int old, tmp;
 
@@ -119,7 +119,7 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u)
 
        return old;
 }
-#define __atomic_add_unless    __atomic_add_unless
+#define atomic_fetch_add_unless        atomic_fetch_add_unless
 
 #include <asm-generic/atomic.h>
 
index 88bae6676c9b6ef3823f6a8590882d43b0d83b22..7748abced766c4bdd4bfb55ff53eb7a9e95b8a4b 100644 (file)
@@ -78,7 +78,7 @@ static __inline__ int atomic_read(const atomic_t *v)
 #define atomic_xchg(v, new) (xchg(&((v)->counter), new))
 
 /**
- * __atomic_add_unless - add unless the number is a given value
+ * atomic_fetch_add_unless - add unless the number is a given value
  * @v: pointer of type atomic_t
  * @a: the amount to add to v...
  * @u: ...unless v is equal to u.
@@ -86,7 +86,7 @@ static __inline__ int atomic_read(const atomic_t *v)
  * Atomically adds @a to @v, so long as it was not @u.
  * Returns the old value of @v.
  */
-static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
+static __inline__ int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int c, old;
        c = atomic_read(v);
index 682b3e6a1e212d7ab0c38246ec7168ca7fbdf805..1483261080a1fdc007e708acd620325cf252d0c3 100644 (file)
@@ -218,7 +218,7 @@ static __inline__ int atomic_dec_return_relaxed(atomic_t *v)
 #define atomic_xchg_relaxed(v, new) xchg_relaxed(&((v)->counter), (new))
 
 /**
- * __atomic_add_unless - add unless the number is a given value
+ * atomic_fetch_add_unless - add unless the number is a given value
  * @v: pointer of type atomic_t
  * @a: the amount to add to v...
  * @u: ...unless v is equal to u.
@@ -226,13 +226,13 @@ static __inline__ int atomic_dec_return_relaxed(atomic_t *v)
  * Atomically adds @a to @v, so long as it was not @u.
  * Returns the old value of @v.
  */
-static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
+static __inline__ int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int t;
 
        __asm__ __volatile__ (
        PPC_ATOMIC_ENTRY_BARRIER
-"1:    lwarx   %0,0,%1         # __atomic_add_unless\n\
+"1:    lwarx   %0,0,%1         # atomic_fetch_add_unless\n\
        cmpw    0,%0,%3 \n\
        beq     2f \n\
        add     %0,%2,%0 \n"
@@ -538,7 +538,7 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
 
        __asm__ __volatile__ (
        PPC_ATOMIC_ENTRY_BARRIER
-"1:    ldarx   %0,0,%1         # __atomic_add_unless\n\
+"1:    ldarx   %0,0,%1         # atomic_fetch_add_unless\n\
        cmpd    0,%0,%3 \n\
        beq     2f \n\
        add     %0,%2,%0 \n"
index 855115ace98c8cdccb7083ca4aacb3a2b20e3259..739e810c857e4ae654b32ea3d8afbca0575e7cb9 100644 (file)
@@ -332,7 +332,7 @@ ATOMIC_OP(dec_and_test, dec, ==, 0, 64)
 #undef ATOMIC_OP
 
 /* This is required to provide a full barrier on success. */
-static __always_inline int __atomic_add_unless(atomic_t *v, int a, int u)
+static __always_inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int prev, rc;
 
@@ -381,7 +381,7 @@ static __always_inline int atomic64_add_unless(atomic64_t *v, long a, long u)
  */
 static __always_inline int atomic_inc_not_zero(atomic_t *v)
 {
-        return __atomic_add_unless(v, 1, 0);
+        return atomic_fetch_add_unless(v, 1, 0);
 }
 
 #ifndef CONFIG_GENERIC_ATOMIC64
index 4b55532f15c4252e6ea698154f605a0412edd698..c2858cdd8c299bff36f4d7b1c26d2b7c6682541d 100644 (file)
@@ -90,7 +90,7 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
        return __atomic_cmpxchg(&v->counter, old, new);
 }
 
-static inline int __atomic_add_unless(atomic_t *v, int a, int u)
+static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int c, old;
        c = atomic_read(v);
index 0fd0099f43cca4fe830ef0664554280fe7d24055..ef45931ebac5a691b7cd36d843603ed19fcad575 100644 (file)
@@ -46,7 +46,7 @@
 #define atomic_cmpxchg(v, o, n)                (cmpxchg(&((v)->counter), (o), (n)))
 
 /**
- * __atomic_add_unless - add unless the number is a given value
+ * atomic_fetch_add_unless - add unless the number is a given value
  * @v: pointer of type atomic_t
  * @a: the amount to add to v...
  * @u: ...unless v is equal to u.
@@ -54,7 +54,7 @@
  * Atomically adds @a to @v, so long as it was not @u.
  * Returns the old value of @v.
  */
-static inline int __atomic_add_unless(atomic_t *v, int a, int u)
+static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int c, old;
        c = atomic_read(v);
index d13ce517f4b9946382579a7a4d5e9bbccdb6332e..a58f4b43bcc74e6edb91b6718e5c1b9993fe63f2 100644 (file)
@@ -27,7 +27,7 @@ int atomic_fetch_or(int, atomic_t *);
 int atomic_fetch_xor(int, atomic_t *);
 int atomic_cmpxchg(atomic_t *, int, int);
 int atomic_xchg(atomic_t *, int);
-int __atomic_add_unless(atomic_t *, int, int);
+int atomic_fetch_add_unless(atomic_t *, int, int);
 void atomic_set(atomic_t *, int);
 
 #define atomic_set_release(v, i)       atomic_set((v), (i))
index 28db058d471b14809a3efb775489e92a0b816f12..f416fd3d270854f595ec6f9cb01ce714ae3337dc 100644 (file)
@@ -89,7 +89,7 @@ static inline int atomic_xchg(atomic_t *v, int new)
        return xchg(&v->counter, new);
 }
 
-static inline int __atomic_add_unless(atomic_t *v, int a, int u)
+static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int c, old;
        c = atomic_read(v);
index 465a901a0ada71aef7ac08e36c90b7f528ae809d..281fa634bb1a80e023b4b6c2a68b5e225fd80868 100644 (file)
@@ -95,7 +95,7 @@ int atomic_cmpxchg(atomic_t *v, int old, int new)
 }
 EXPORT_SYMBOL(atomic_cmpxchg);
 
-int __atomic_add_unless(atomic_t *v, int a, int u)
+int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int ret;
        unsigned long flags;
@@ -107,7 +107,7 @@ int __atomic_add_unless(atomic_t *v, int a, int u)
        spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
        return ret;
 }
-EXPORT_SYMBOL(__atomic_add_unless);
+EXPORT_SYMBOL(atomic_fetch_add_unless);
 
 /* Atomic operations are already serializing */
 void atomic_set(atomic_t *v, int i)
index 0db6bec95489ebc703df2650e98c7f624cc7bff9..84ed0bd76aefa67b5a5be6e7f1cf75aa70ccb739 100644 (file)
@@ -254,7 +254,7 @@ static inline int arch_atomic_fetch_xor(int i, atomic_t *v)
 }
 
 /**
- * __arch_atomic_add_unless - add unless the number is already a given value
+ * arch_atomic_fetch_add_unless - add unless the number is already a given value
  * @v: pointer of type atomic_t
  * @a: the amount to add to v...
  * @u: ...unless v is equal to u.
@@ -262,7 +262,7 @@ static inline int arch_atomic_fetch_xor(int i, atomic_t *v)
  * Atomically adds @a to @v, so long as @v was not already @u.
  * Returns the old value of @v.
  */
-static __always_inline int __arch_atomic_add_unless(atomic_t *v, int a, int u)
+static __always_inline int arch_atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int c = arch_atomic_read(v);
 
index e7a23f2a519af7be68a9db30b4c112fb344efdda..4188e56c06c9e8a04508d7f4aeb40606ddffed0d 100644 (file)
@@ -275,7 +275,7 @@ ATOMIC_OPS(xor)
 #define atomic_xchg(v, new) (xchg(&((v)->counter), new))
 
 /**
- * __atomic_add_unless - add unless the number is a given value
+ * atomic_fetch_add_unless - add unless the number is a given value
  * @v: pointer of type atomic_t
  * @a: the amount to add to v...
  * @u: ...unless v is equal to u.
@@ -283,7 +283,7 @@ ATOMIC_OPS(xor)
  * Atomically adds @a to @v, so long as it was not @u.
  * Returns the old value of @v.
  */
-static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
+static __inline__ int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int c, old;
        c = atomic_read(v);
index fa0729c1e776e21834f02caa2d42ac7867c5ad36..d81c653b9bf61587db1684305dc296a85d05818a 100644 (file)
@@ -61,7 +61,7 @@ static int atomic_inc_return_safe(atomic_t *v)
 {
        unsigned int counter;
 
-       counter = (unsigned int)__atomic_add_unless(v, 1, 0);
+       counter = (unsigned int)atomic_fetch_add_unless(v, 1, 0);
        if (counter <= (unsigned int)INT_MAX)
                return (int)counter;
 
index a6e904973ba8a08973340b66f608eadfa04e2893..475910ffbcb6800f2e729f012b795483cbcc5c15 100644 (file)
@@ -121,7 +121,7 @@ static int uverbs_try_lock_object(struct ib_uobject *uobj, bool exclusive)
         * this lock.
         */
        if (!exclusive)
-               return __atomic_add_unless(&uobj->usecnt, 1, -1) == -1 ?
+               return atomic_fetch_add_unless(&uobj->usecnt, 1, -1) == -1 ?
                        -EBUSY : 0;
 
        /* lock is either WRITE or DESTROY - should be exclusive */
index a1b18082991b2088711a2bca42f173fa951e49e8..183cc5418722602b61b87cfc6ca73c5d6dcbb5d8 100644 (file)
@@ -648,7 +648,7 @@ static void afs_wake_up_async_call(struct sock *sk, struct rxrpc_call *rxcall,
        trace_afs_notify_call(rxcall, call);
        call->need_attention = true;
 
-       u = __atomic_add_unless(&call->usage, 1, 0);
+       u = atomic_fetch_add_unless(&call->usage, 1, 0);
        if (u != 0) {
                trace_afs_call(call, afs_call_trace_wake, u,
                               atomic_read(&call->net->nr_outstanding_calls),
index ec07f23678ea6a507539b92d7df7577ccf54e0a0..b8b14cc2df6c79cc017b1f573f884a2b6d31871e 100644 (file)
@@ -84,10 +84,10 @@ static __always_inline bool atomic64_try_cmpxchg(atomic64_t *v, s64 *old, s64 ne
 }
 #endif
 
-static __always_inline int __atomic_add_unless(atomic_t *v, int a, int u)
+static __always_inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        kasan_check_write(v, sizeof(*v));
-       return __arch_atomic_add_unless(v, a, u);
+       return arch_atomic_fetch_add_unless(v, a, u);
 }
 
 
index abe6dd9ca2a86578de4fa87b70d82bb79adc0b77..10051ed6d08858284359ddc3d446b07ed5576401 100644 (file)
@@ -221,8 +221,8 @@ 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)))
 
-#ifndef __atomic_add_unless
-static inline int __atomic_add_unless(atomic_t *v, int a, int u)
+#ifndef atomic_fetch_add_unless
+static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 {
        int c, old;
        c = atomic_read(v);
index 01ce3997cb4237b40fba2cbe8af1b69d6bc33fed..9cc982936675c3178963c339836bb66fa2424432 100644 (file)
  */
 static inline int atomic_add_unless(atomic_t *v, int a, int u)
 {
-       return __atomic_add_unless(v, a, u) != u;
+       return atomic_fetch_add_unless(v, a, u) != u;
 }
 
 /**
index 35dc466641f2609cdd13a6f179e81c877144e5c7..f12db70d3bf36b8a1b0f451497e3fded88916fda 100644 (file)
@@ -575,7 +575,7 @@ static struct bpf_map *bpf_map_inc_not_zero(struct bpf_map *map,
 {
        int refold;
 
-       refold = __atomic_add_unless(&map->refcnt, 1, 0);
+       refold = atomic_fetch_add_unless(&map->refcnt, 1, 0);
 
        if (refold >= BPF_MAX_REFCNT) {
                __bpf_map_put(map, false);
@@ -1142,7 +1142,7 @@ struct bpf_prog *bpf_prog_inc_not_zero(struct bpf_prog *prog)
 {
        int refold;
 
-       refold = __atomic_add_unless(&prog->aux->refcnt, 1, 0);
+       refold = atomic_fetch_add_unless(&prog->aux->refcnt, 1, 0);
 
        if (refold >= BPF_MAX_REFCNT) {
                __bpf_prog_put(prog, false);
index f6734d8cb01a711317854a17c981b2506625846b..9486293fef5c6f98c96397fc90eb14eecf332196 100644 (file)
@@ -415,7 +415,7 @@ void rxrpc_incoming_call(struct rxrpc_sock *rx,
 bool rxrpc_queue_call(struct rxrpc_call *call)
 {
        const void *here = __builtin_return_address(0);
-       int n = __atomic_add_unless(&call->usage, 1, 0);
+       int n = atomic_fetch_add_unless(&call->usage, 1, 0);
        if (n == 0)
                return false;
        if (rxrpc_queue_work(&call->processor))
index 4c77a78a252af9a19d4801d3904847475a4d5341..77440a356b14ae60e875fcd94a2613227fd899cf 100644 (file)
@@ -266,7 +266,7 @@ void rxrpc_kill_connection(struct rxrpc_connection *conn)
 bool rxrpc_queue_conn(struct rxrpc_connection *conn)
 {
        const void *here = __builtin_return_address(0);
-       int n = __atomic_add_unless(&conn->usage, 1, 0);
+       int n = atomic_fetch_add_unless(&conn->usage, 1, 0);
        if (n == 0)
                return false;
        if (rxrpc_queue_work(&conn->processor))
@@ -309,7 +309,7 @@ rxrpc_get_connection_maybe(struct rxrpc_connection *conn)
        const void *here = __builtin_return_address(0);
 
        if (conn) {
-               int n = __atomic_add_unless(&conn->usage, 1, 0);
+               int n = atomic_fetch_add_unless(&conn->usage, 1, 0);
                if (n > 0)
                        trace_rxrpc_conn(conn, rxrpc_conn_got, n + 1, here);
                else
index b493e6b6274043e07b15c5a0481f0e92a4478ea4..777c3ed4cfc03d3923e052d95597926a1893a163 100644 (file)
@@ -305,7 +305,7 @@ struct rxrpc_local *rxrpc_get_local_maybe(struct rxrpc_local *local)
        const void *here = __builtin_return_address(0);
 
        if (local) {
-               int n = __atomic_add_unless(&local->usage, 1, 0);
+               int n = atomic_fetch_add_unless(&local->usage, 1, 0);
                if (n > 0)
                        trace_rxrpc_local(local, rxrpc_local_got, n + 1, here);
                else
index 1b7e8107b3ae8a144bc72d01f6e1277368b3cbad..1cf3b408017a6553e8c959d3791d2d6d1f892638 100644 (file)
@@ -406,7 +406,7 @@ struct rxrpc_peer *rxrpc_get_peer_maybe(struct rxrpc_peer *peer)
        const void *here = __builtin_return_address(0);
 
        if (peer) {
-               int n = __atomic_add_unless(&peer->usage, 1, 0);
+               int n = atomic_fetch_add_unless(&peer->usage, 1, 0);
                if (n > 0)
                        trace_rxrpc_peer(peer, rxrpc_peer_got, n + 1, here);
                else