Commit 67d1b0de authored by Mark Rutland's avatar Mark Rutland Committed by Peter Zijlstra

locking/atomic: add arch_atomic_long*()

Now that all architectures provide arch_{atomic,atomic64}_*(), we can
build arch_atomic_long_*() atop these, which can be safely used in
noinstr code. The regular atomic_long_*() wrappers are built atop these,
as we do for {atomic,atomic64}_*() atop arch_{atomic,atomic64}_*().

We don't provide arch_* versions of the cond_read*() variants, as we
don't have arch_* versions of the underlying atomic/atomic64 functions
(nor the smp_cond_load*() helpers these are typically based on).

Note that the headers in this patch under include/linux/atomic/ are
generated by the scripts in scripts/atomic/.
Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20210713105253.7615-5-mark.rutland@arm.com
parent e3d18cee
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
}) })
#include <linux/atomic/atomic-arch-fallback.h> #include <linux/atomic/atomic-arch-fallback.h>
#include <linux/atomic/atomic-instrumented.h>
#include <linux/atomic/atomic-long.h> #include <linux/atomic/atomic-long.h>
#include <linux/atomic/atomic-instrumented.h>
#endif /* _LINUX_ATOMIC_H */ #endif /* _LINUX_ATOMIC_H */
...@@ -1177,6 +1177,584 @@ atomic64_dec_if_positive(atomic64_t *v) ...@@ -1177,6 +1177,584 @@ atomic64_dec_if_positive(atomic64_t *v)
return arch_atomic64_dec_if_positive(v); return arch_atomic64_dec_if_positive(v);
} }
static __always_inline long
atomic_long_read(const atomic_long_t *v)
{
instrument_atomic_read(v, sizeof(*v));
return arch_atomic_long_read(v);
}
static __always_inline long
atomic_long_read_acquire(const atomic_long_t *v)
{
instrument_atomic_read(v, sizeof(*v));
return arch_atomic_long_read_acquire(v);
}
static __always_inline void
atomic_long_set(atomic_long_t *v, long i)
{
instrument_atomic_write(v, sizeof(*v));
arch_atomic_long_set(v, i);
}
static __always_inline void
atomic_long_set_release(atomic_long_t *v, long i)
{
instrument_atomic_write(v, sizeof(*v));
arch_atomic_long_set_release(v, i);
}
static __always_inline void
atomic_long_add(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
arch_atomic_long_add(i, v);
}
static __always_inline long
atomic_long_add_return(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_add_return(i, v);
}
static __always_inline long
atomic_long_add_return_acquire(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_add_return_acquire(i, v);
}
static __always_inline long
atomic_long_add_return_release(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_add_return_release(i, v);
}
static __always_inline long
atomic_long_add_return_relaxed(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_add_return_relaxed(i, v);
}
static __always_inline long
atomic_long_fetch_add(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_add(i, v);
}
static __always_inline long
atomic_long_fetch_add_acquire(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_add_acquire(i, v);
}
static __always_inline long
atomic_long_fetch_add_release(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_add_release(i, v);
}
static __always_inline long
atomic_long_fetch_add_relaxed(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_add_relaxed(i, v);
}
static __always_inline void
atomic_long_sub(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
arch_atomic_long_sub(i, v);
}
static __always_inline long
atomic_long_sub_return(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_sub_return(i, v);
}
static __always_inline long
atomic_long_sub_return_acquire(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_sub_return_acquire(i, v);
}
static __always_inline long
atomic_long_sub_return_release(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_sub_return_release(i, v);
}
static __always_inline long
atomic_long_sub_return_relaxed(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_sub_return_relaxed(i, v);
}
static __always_inline long
atomic_long_fetch_sub(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_sub(i, v);
}
static __always_inline long
atomic_long_fetch_sub_acquire(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_sub_acquire(i, v);
}
static __always_inline long
atomic_long_fetch_sub_release(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_sub_release(i, v);
}
static __always_inline long
atomic_long_fetch_sub_relaxed(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_sub_relaxed(i, v);
}
static __always_inline void
atomic_long_inc(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
arch_atomic_long_inc(v);
}
static __always_inline long
atomic_long_inc_return(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_inc_return(v);
}
static __always_inline long
atomic_long_inc_return_acquire(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_inc_return_acquire(v);
}
static __always_inline long
atomic_long_inc_return_release(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_inc_return_release(v);
}
static __always_inline long
atomic_long_inc_return_relaxed(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_inc_return_relaxed(v);
}
static __always_inline long
atomic_long_fetch_inc(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_inc(v);
}
static __always_inline long
atomic_long_fetch_inc_acquire(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_inc_acquire(v);
}
static __always_inline long
atomic_long_fetch_inc_release(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_inc_release(v);
}
static __always_inline long
atomic_long_fetch_inc_relaxed(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_inc_relaxed(v);
}
static __always_inline void
atomic_long_dec(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
arch_atomic_long_dec(v);
}
static __always_inline long
atomic_long_dec_return(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_dec_return(v);
}
static __always_inline long
atomic_long_dec_return_acquire(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_dec_return_acquire(v);
}
static __always_inline long
atomic_long_dec_return_release(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_dec_return_release(v);
}
static __always_inline long
atomic_long_dec_return_relaxed(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_dec_return_relaxed(v);
}
static __always_inline long
atomic_long_fetch_dec(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_dec(v);
}
static __always_inline long
atomic_long_fetch_dec_acquire(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_dec_acquire(v);
}
static __always_inline long
atomic_long_fetch_dec_release(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_dec_release(v);
}
static __always_inline long
atomic_long_fetch_dec_relaxed(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_dec_relaxed(v);
}
static __always_inline void
atomic_long_and(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
arch_atomic_long_and(i, v);
}
static __always_inline long
atomic_long_fetch_and(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_and(i, v);
}
static __always_inline long
atomic_long_fetch_and_acquire(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_and_acquire(i, v);
}
static __always_inline long
atomic_long_fetch_and_release(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_and_release(i, v);
}
static __always_inline long
atomic_long_fetch_and_relaxed(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_and_relaxed(i, v);
}
static __always_inline void
atomic_long_andnot(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
arch_atomic_long_andnot(i, v);
}
static __always_inline long
atomic_long_fetch_andnot(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_andnot(i, v);
}
static __always_inline long
atomic_long_fetch_andnot_acquire(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_andnot_acquire(i, v);
}
static __always_inline long
atomic_long_fetch_andnot_release(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_andnot_release(i, v);
}
static __always_inline long
atomic_long_fetch_andnot_relaxed(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_andnot_relaxed(i, v);
}
static __always_inline void
atomic_long_or(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
arch_atomic_long_or(i, v);
}
static __always_inline long
atomic_long_fetch_or(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_or(i, v);
}
static __always_inline long
atomic_long_fetch_or_acquire(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_or_acquire(i, v);
}
static __always_inline long
atomic_long_fetch_or_release(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_or_release(i, v);
}
static __always_inline long
atomic_long_fetch_or_relaxed(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_or_relaxed(i, v);
}
static __always_inline void
atomic_long_xor(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
arch_atomic_long_xor(i, v);
}
static __always_inline long
atomic_long_fetch_xor(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_xor(i, v);
}
static __always_inline long
atomic_long_fetch_xor_acquire(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_xor_acquire(i, v);
}
static __always_inline long
atomic_long_fetch_xor_release(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_xor_release(i, v);
}
static __always_inline long
atomic_long_fetch_xor_relaxed(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_xor_relaxed(i, v);
}
static __always_inline long
atomic_long_xchg(atomic_long_t *v, long i)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_xchg(v, i);
}
static __always_inline long
atomic_long_xchg_acquire(atomic_long_t *v, long i)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_xchg_acquire(v, i);
}
static __always_inline long
atomic_long_xchg_release(atomic_long_t *v, long i)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_xchg_release(v, i);
}
static __always_inline long
atomic_long_xchg_relaxed(atomic_long_t *v, long i)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_xchg_relaxed(v, i);
}
static __always_inline long
atomic_long_cmpxchg(atomic_long_t *v, long old, long new)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_cmpxchg(v, old, new);
}
static __always_inline long
atomic_long_cmpxchg_acquire(atomic_long_t *v, long old, long new)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_cmpxchg_acquire(v, old, new);
}
static __always_inline long
atomic_long_cmpxchg_release(atomic_long_t *v, long old, long new)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_cmpxchg_release(v, old, new);
}
static __always_inline long
atomic_long_cmpxchg_relaxed(atomic_long_t *v, long old, long new)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_cmpxchg_relaxed(v, old, new);
}
static __always_inline bool
atomic_long_try_cmpxchg(atomic_long_t *v, long *old, long new)
{
instrument_atomic_read_write(v, sizeof(*v));
instrument_atomic_read_write(old, sizeof(*old));
return arch_atomic_long_try_cmpxchg(v, old, new);
}
static __always_inline bool
atomic_long_try_cmpxchg_acquire(atomic_long_t *v, long *old, long new)
{
instrument_atomic_read_write(v, sizeof(*v));
instrument_atomic_read_write(old, sizeof(*old));
return arch_atomic_long_try_cmpxchg_acquire(v, old, new);
}
static __always_inline bool
atomic_long_try_cmpxchg_release(atomic_long_t *v, long *old, long new)
{
instrument_atomic_read_write(v, sizeof(*v));
instrument_atomic_read_write(old, sizeof(*old));
return arch_atomic_long_try_cmpxchg_release(v, old, new);
}
static __always_inline bool
atomic_long_try_cmpxchg_relaxed(atomic_long_t *v, long *old, long new)
{
instrument_atomic_read_write(v, sizeof(*v));
instrument_atomic_read_write(old, sizeof(*old));
return arch_atomic_long_try_cmpxchg_relaxed(v, old, new);
}
static __always_inline bool
atomic_long_sub_and_test(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_sub_and_test(i, v);
}
static __always_inline bool
atomic_long_dec_and_test(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_dec_and_test(v);
}
static __always_inline bool
atomic_long_inc_and_test(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_inc_and_test(v);
}
static __always_inline bool
atomic_long_add_negative(long i, atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_add_negative(i, v);
}
static __always_inline long
atomic_long_fetch_add_unless(atomic_long_t *v, long a, long u)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_fetch_add_unless(v, a, u);
}
static __always_inline bool
atomic_long_add_unless(atomic_long_t *v, long a, long u)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_add_unless(v, a, u);
}
static __always_inline bool
atomic_long_inc_not_zero(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_inc_not_zero(v);
}
static __always_inline bool
atomic_long_inc_unless_negative(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_inc_unless_negative(v);
}
static __always_inline bool
atomic_long_dec_unless_positive(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_dec_unless_positive(v);
}
static __always_inline long
atomic_long_dec_if_positive(atomic_long_t *v)
{
instrument_atomic_read_write(v, sizeof(*v));
return arch_atomic_long_dec_if_positive(v);
}
#define xchg(ptr, ...) \ #define xchg(ptr, ...) \
({ \ ({ \
typeof(ptr) __ai_ptr = (ptr); \ typeof(ptr) __ai_ptr = (ptr); \
...@@ -1334,4 +1912,4 @@ atomic64_dec_if_positive(atomic64_t *v) ...@@ -1334,4 +1912,4 @@ atomic64_dec_if_positive(atomic64_t *v)
}) })
#endif /* _LINUX_ATOMIC_INSTRUMENTED_H */ #endif /* _LINUX_ATOMIC_INSTRUMENTED_H */
// 5edd72f105b6f54b7e9492d794abee88e6912d29 // 2a9553f0a9d5619f19151092df5cabbbf16ce835
...@@ -24,991 +24,991 @@ typedef atomic_t atomic_long_t; ...@@ -24,991 +24,991 @@ typedef atomic_t atomic_long_t;
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
static __always_inline long static __always_inline long
atomic_long_read(const atomic_long_t *v) arch_atomic_long_read(const atomic_long_t *v)
{ {
return atomic64_read(v); return arch_atomic64_read(v);
} }
static __always_inline long static __always_inline long
atomic_long_read_acquire(const atomic_long_t *v) arch_atomic_long_read_acquire(const atomic_long_t *v)
{ {
return atomic64_read_acquire(v); return arch_atomic64_read_acquire(v);
} }
static __always_inline void static __always_inline void
atomic_long_set(atomic_long_t *v, long i) arch_atomic_long_set(atomic_long_t *v, long i)
{ {
atomic64_set(v, i); arch_atomic64_set(v, i);
} }
static __always_inline void static __always_inline void
atomic_long_set_release(atomic_long_t *v, long i) arch_atomic_long_set_release(atomic_long_t *v, long i)
{ {
atomic64_set_release(v, i); arch_atomic64_set_release(v, i);
} }
static __always_inline void static __always_inline void
atomic_long_add(long i, atomic_long_t *v) arch_atomic_long_add(long i, atomic_long_t *v)
{ {
atomic64_add(i, v); arch_atomic64_add(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_add_return(long i, atomic_long_t *v) arch_atomic_long_add_return(long i, atomic_long_t *v)
{ {
return atomic64_add_return(i, v); return arch_atomic64_add_return(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_add_return_acquire(long i, atomic_long_t *v) arch_atomic_long_add_return_acquire(long i, atomic_long_t *v)
{ {
return atomic64_add_return_acquire(i, v); return arch_atomic64_add_return_acquire(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_add_return_release(long i, atomic_long_t *v) arch_atomic_long_add_return_release(long i, atomic_long_t *v)
{ {
return atomic64_add_return_release(i, v); return arch_atomic64_add_return_release(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_add_return_relaxed(long i, atomic_long_t *v) arch_atomic_long_add_return_relaxed(long i, atomic_long_t *v)
{ {
return atomic64_add_return_relaxed(i, v); return arch_atomic64_add_return_relaxed(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_add(long i, atomic_long_t *v) arch_atomic_long_fetch_add(long i, atomic_long_t *v)
{ {
return atomic64_fetch_add(i, v); return arch_atomic64_fetch_add(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_add_acquire(long i, atomic_long_t *v) arch_atomic_long_fetch_add_acquire(long i, atomic_long_t *v)
{ {
return atomic64_fetch_add_acquire(i, v); return arch_atomic64_fetch_add_acquire(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_add_release(long i, atomic_long_t *v) arch_atomic_long_fetch_add_release(long i, atomic_long_t *v)
{ {
return atomic64_fetch_add_release(i, v); return arch_atomic64_fetch_add_release(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_add_relaxed(long i, atomic_long_t *v) arch_atomic_long_fetch_add_relaxed(long i, atomic_long_t *v)
{ {
return atomic64_fetch_add_relaxed(i, v); return arch_atomic64_fetch_add_relaxed(i, v);
} }
static __always_inline void static __always_inline void
atomic_long_sub(long i, atomic_long_t *v) arch_atomic_long_sub(long i, atomic_long_t *v)
{ {
atomic64_sub(i, v); arch_atomic64_sub(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_sub_return(long i, atomic_long_t *v) arch_atomic_long_sub_return(long i, atomic_long_t *v)
{ {
return atomic64_sub_return(i, v); return arch_atomic64_sub_return(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_sub_return_acquire(long i, atomic_long_t *v) arch_atomic_long_sub_return_acquire(long i, atomic_long_t *v)
{ {
return atomic64_sub_return_acquire(i, v); return arch_atomic64_sub_return_acquire(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_sub_return_release(long i, atomic_long_t *v) arch_atomic_long_sub_return_release(long i, atomic_long_t *v)
{ {
return atomic64_sub_return_release(i, v); return arch_atomic64_sub_return_release(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_sub_return_relaxed(long i, atomic_long_t *v) arch_atomic_long_sub_return_relaxed(long i, atomic_long_t *v)
{ {
return atomic64_sub_return_relaxed(i, v); return arch_atomic64_sub_return_relaxed(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_sub(long i, atomic_long_t *v) arch_atomic_long_fetch_sub(long i, atomic_long_t *v)
{ {
return atomic64_fetch_sub(i, v); return arch_atomic64_fetch_sub(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_sub_acquire(long i, atomic_long_t *v) arch_atomic_long_fetch_sub_acquire(long i, atomic_long_t *v)
{ {
return atomic64_fetch_sub_acquire(i, v); return arch_atomic64_fetch_sub_acquire(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_sub_release(long i, atomic_long_t *v) arch_atomic_long_fetch_sub_release(long i, atomic_long_t *v)
{ {
return atomic64_fetch_sub_release(i, v); return arch_atomic64_fetch_sub_release(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_sub_relaxed(long i, atomic_long_t *v) arch_atomic_long_fetch_sub_relaxed(long i, atomic_long_t *v)
{ {
return atomic64_fetch_sub_relaxed(i, v); return arch_atomic64_fetch_sub_relaxed(i, v);
} }
static __always_inline void static __always_inline void
atomic_long_inc(atomic_long_t *v) arch_atomic_long_inc(atomic_long_t *v)
{ {
atomic64_inc(v); arch_atomic64_inc(v);
} }
static __always_inline long static __always_inline long
atomic_long_inc_return(atomic_long_t *v) arch_atomic_long_inc_return(atomic_long_t *v)
{ {
return atomic64_inc_return(v); return arch_atomic64_inc_return(v);
} }
static __always_inline long static __always_inline long
atomic_long_inc_return_acquire(atomic_long_t *v) arch_atomic_long_inc_return_acquire(atomic_long_t *v)
{ {
return atomic64_inc_return_acquire(v); return arch_atomic64_inc_return_acquire(v);
} }
static __always_inline long static __always_inline long
atomic_long_inc_return_release(atomic_long_t *v) arch_atomic_long_inc_return_release(atomic_long_t *v)
{ {
return atomic64_inc_return_release(v); return arch_atomic64_inc_return_release(v);
} }
static __always_inline long static __always_inline long
atomic_long_inc_return_relaxed(atomic_long_t *v) arch_atomic_long_inc_return_relaxed(atomic_long_t *v)
{ {
return atomic64_inc_return_relaxed(v); return arch_atomic64_inc_return_relaxed(v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_inc(atomic_long_t *v) arch_atomic_long_fetch_inc(atomic_long_t *v)
{ {
return atomic64_fetch_inc(v); return arch_atomic64_fetch_inc(v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_inc_acquire(atomic_long_t *v) arch_atomic_long_fetch_inc_acquire(atomic_long_t *v)
{ {
return atomic64_fetch_inc_acquire(v); return arch_atomic64_fetch_inc_acquire(v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_inc_release(atomic_long_t *v) arch_atomic_long_fetch_inc_release(atomic_long_t *v)
{ {
return atomic64_fetch_inc_release(v); return arch_atomic64_fetch_inc_release(v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_inc_relaxed(atomic_long_t *v) arch_atomic_long_fetch_inc_relaxed(atomic_long_t *v)
{ {
return atomic64_fetch_inc_relaxed(v); return arch_atomic64_fetch_inc_relaxed(v);
} }
static __always_inline void static __always_inline void
atomic_long_dec(atomic_long_t *v) arch_atomic_long_dec(atomic_long_t *v)
{ {
atomic64_dec(v); arch_atomic64_dec(v);
} }
static __always_inline long static __always_inline long
atomic_long_dec_return(atomic_long_t *v) arch_atomic_long_dec_return(atomic_long_t *v)
{ {
return atomic64_dec_return(v); return arch_atomic64_dec_return(v);
} }
static __always_inline long static __always_inline long
atomic_long_dec_return_acquire(atomic_long_t *v) arch_atomic_long_dec_return_acquire(atomic_long_t *v)
{ {
return atomic64_dec_return_acquire(v); return arch_atomic64_dec_return_acquire(v);
} }
static __always_inline long static __always_inline long
atomic_long_dec_return_release(atomic_long_t *v) arch_atomic_long_dec_return_release(atomic_long_t *v)
{ {
return atomic64_dec_return_release(v); return arch_atomic64_dec_return_release(v);
} }
static __always_inline long static __always_inline long
atomic_long_dec_return_relaxed(atomic_long_t *v) arch_atomic_long_dec_return_relaxed(atomic_long_t *v)
{ {
return atomic64_dec_return_relaxed(v); return arch_atomic64_dec_return_relaxed(v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_dec(atomic_long_t *v) arch_atomic_long_fetch_dec(atomic_long_t *v)
{ {
return atomic64_fetch_dec(v); return arch_atomic64_fetch_dec(v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_dec_acquire(atomic_long_t *v) arch_atomic_long_fetch_dec_acquire(atomic_long_t *v)
{ {
return atomic64_fetch_dec_acquire(v); return arch_atomic64_fetch_dec_acquire(v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_dec_release(atomic_long_t *v) arch_atomic_long_fetch_dec_release(atomic_long_t *v)
{ {
return atomic64_fetch_dec_release(v); return arch_atomic64_fetch_dec_release(v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_dec_relaxed(atomic_long_t *v) arch_atomic_long_fetch_dec_relaxed(atomic_long_t *v)
{ {
return atomic64_fetch_dec_relaxed(v); return arch_atomic64_fetch_dec_relaxed(v);
} }
static __always_inline void static __always_inline void
atomic_long_and(long i, atomic_long_t *v) arch_atomic_long_and(long i, atomic_long_t *v)
{ {
atomic64_and(i, v); arch_atomic64_and(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_and(long i, atomic_long_t *v) arch_atomic_long_fetch_and(long i, atomic_long_t *v)
{ {
return atomic64_fetch_and(i, v); return arch_atomic64_fetch_and(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_and_acquire(long i, atomic_long_t *v) arch_atomic_long_fetch_and_acquire(long i, atomic_long_t *v)
{ {
return atomic64_fetch_and_acquire(i, v); return arch_atomic64_fetch_and_acquire(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_and_release(long i, atomic_long_t *v) arch_atomic_long_fetch_and_release(long i, atomic_long_t *v)
{ {
return atomic64_fetch_and_release(i, v); return arch_atomic64_fetch_and_release(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_and_relaxed(long i, atomic_long_t *v) arch_atomic_long_fetch_and_relaxed(long i, atomic_long_t *v)
{ {
return atomic64_fetch_and_relaxed(i, v); return arch_atomic64_fetch_and_relaxed(i, v);
} }
static __always_inline void static __always_inline void
atomic_long_andnot(long i, atomic_long_t *v) arch_atomic_long_andnot(long i, atomic_long_t *v)
{ {
atomic64_andnot(i, v); arch_atomic64_andnot(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_andnot(long i, atomic_long_t *v) arch_atomic_long_fetch_andnot(long i, atomic_long_t *v)
{ {
return atomic64_fetch_andnot(i, v); return arch_atomic64_fetch_andnot(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_andnot_acquire(long i, atomic_long_t *v) arch_atomic_long_fetch_andnot_acquire(long i, atomic_long_t *v)
{ {
return atomic64_fetch_andnot_acquire(i, v); return arch_atomic64_fetch_andnot_acquire(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_andnot_release(long i, atomic_long_t *v) arch_atomic_long_fetch_andnot_release(long i, atomic_long_t *v)
{ {
return atomic64_fetch_andnot_release(i, v); return arch_atomic64_fetch_andnot_release(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_andnot_relaxed(long i, atomic_long_t *v) arch_atomic_long_fetch_andnot_relaxed(long i, atomic_long_t *v)
{ {
return atomic64_fetch_andnot_relaxed(i, v); return arch_atomic64_fetch_andnot_relaxed(i, v);
} }
static __always_inline void static __always_inline void
atomic_long_or(long i, atomic_long_t *v) arch_atomic_long_or(long i, atomic_long_t *v)
{ {
atomic64_or(i, v); arch_atomic64_or(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_or(long i, atomic_long_t *v) arch_atomic_long_fetch_or(long i, atomic_long_t *v)
{ {
return atomic64_fetch_or(i, v); return arch_atomic64_fetch_or(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_or_acquire(long i, atomic_long_t *v) arch_atomic_long_fetch_or_acquire(long i, atomic_long_t *v)
{ {
return atomic64_fetch_or_acquire(i, v); return arch_atomic64_fetch_or_acquire(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_or_release(long i, atomic_long_t *v) arch_atomic_long_fetch_or_release(long i, atomic_long_t *v)
{ {
return atomic64_fetch_or_release(i, v); return arch_atomic64_fetch_or_release(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_or_relaxed(long i, atomic_long_t *v) arch_atomic_long_fetch_or_relaxed(long i, atomic_long_t *v)
{ {
return atomic64_fetch_or_relaxed(i, v); return arch_atomic64_fetch_or_relaxed(i, v);
} }
static __always_inline void static __always_inline void
atomic_long_xor(long i, atomic_long_t *v) arch_atomic_long_xor(long i, atomic_long_t *v)
{ {
atomic64_xor(i, v); arch_atomic64_xor(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_xor(long i, atomic_long_t *v) arch_atomic_long_fetch_xor(long i, atomic_long_t *v)
{ {
return atomic64_fetch_xor(i, v); return arch_atomic64_fetch_xor(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_xor_acquire(long i, atomic_long_t *v) arch_atomic_long_fetch_xor_acquire(long i, atomic_long_t *v)
{ {
return atomic64_fetch_xor_acquire(i, v); return arch_atomic64_fetch_xor_acquire(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_xor_release(long i, atomic_long_t *v) arch_atomic_long_fetch_xor_release(long i, atomic_long_t *v)
{ {
return atomic64_fetch_xor_release(i, v); return arch_atomic64_fetch_xor_release(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_xor_relaxed(long i, atomic_long_t *v) arch_atomic_long_fetch_xor_relaxed(long i, atomic_long_t *v)
{ {
return atomic64_fetch_xor_relaxed(i, v); return arch_atomic64_fetch_xor_relaxed(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_xchg(atomic_long_t *v, long i) arch_atomic_long_xchg(atomic_long_t *v, long i)
{ {
return atomic64_xchg(v, i); return arch_atomic64_xchg(v, i);
} }
static __always_inline long static __always_inline long
atomic_long_xchg_acquire(atomic_long_t *v, long i) arch_atomic_long_xchg_acquire(atomic_long_t *v, long i)
{ {
return atomic64_xchg_acquire(v, i); return arch_atomic64_xchg_acquire(v, i);
} }
static __always_inline long static __always_inline long
atomic_long_xchg_release(atomic_long_t *v, long i) arch_atomic_long_xchg_release(atomic_long_t *v, long i)
{ {
return atomic64_xchg_release(v, i); return arch_atomic64_xchg_release(v, i);
} }
static __always_inline long static __always_inline long
atomic_long_xchg_relaxed(atomic_long_t *v, long i) arch_atomic_long_xchg_relaxed(atomic_long_t *v, long i)
{ {
return atomic64_xchg_relaxed(v, i); return arch_atomic64_xchg_relaxed(v, i);
} }
static __always_inline long static __always_inline long
atomic_long_cmpxchg(atomic_long_t *v, long old, long new) arch_atomic_long_cmpxchg(atomic_long_t *v, long old, long new)
{ {
return atomic64_cmpxchg(v, old, new); return arch_atomic64_cmpxchg(v, old, new);
} }
static __always_inline long static __always_inline long
atomic_long_cmpxchg_acquire(atomic_long_t *v, long old, long new) arch_atomic_long_cmpxchg_acquire(atomic_long_t *v, long old, long new)
{ {
return atomic64_cmpxchg_acquire(v, old, new); return arch_atomic64_cmpxchg_acquire(v, old, new);
} }
static __always_inline long static __always_inline long
atomic_long_cmpxchg_release(atomic_long_t *v, long old, long new) arch_atomic_long_cmpxchg_release(atomic_long_t *v, long old, long new)
{ {
return atomic64_cmpxchg_release(v, old, new); return arch_atomic64_cmpxchg_release(v, old, new);
} }
static __always_inline long static __always_inline long
atomic_long_cmpxchg_relaxed(atomic_long_t *v, long old, long new) arch_atomic_long_cmpxchg_relaxed(atomic_long_t *v, long old, long new)
{ {
return atomic64_cmpxchg_relaxed(v, old, new); return arch_atomic64_cmpxchg_relaxed(v, old, new);
} }
static __always_inline bool static __always_inline bool
atomic_long_try_cmpxchg(atomic_long_t *v, long *old, long new) arch_atomic_long_try_cmpxchg(atomic_long_t *v, long *old, long new)
{ {
return atomic64_try_cmpxchg(v, (s64 *)old, new); return arch_atomic64_try_cmpxchg(v, (s64 *)old, new);
} }
static __always_inline bool static __always_inline bool
atomic_long_try_cmpxchg_acquire(atomic_long_t *v, long *old, long new) arch_atomic_long_try_cmpxchg_acquire(atomic_long_t *v, long *old, long new)
{ {
return atomic64_try_cmpxchg_acquire(v, (s64 *)old, new); return arch_atomic64_try_cmpxchg_acquire(v, (s64 *)old, new);
} }
static __always_inline bool static __always_inline bool
atomic_long_try_cmpxchg_release(atomic_long_t *v, long *old, long new) arch_atomic_long_try_cmpxchg_release(atomic_long_t *v, long *old, long new)
{ {
return atomic64_try_cmpxchg_release(v, (s64 *)old, new); return arch_atomic64_try_cmpxchg_release(v, (s64 *)old, new);
} }
static __always_inline bool static __always_inline bool
atomic_long_try_cmpxchg_relaxed(atomic_long_t *v, long *old, long new) arch_atomic_long_try_cmpxchg_relaxed(atomic_long_t *v, long *old, long new)
{ {
return atomic64_try_cmpxchg_relaxed(v, (s64 *)old, new); return arch_atomic64_try_cmpxchg_relaxed(v, (s64 *)old, new);
} }
static __always_inline bool static __always_inline bool
atomic_long_sub_and_test(long i, atomic_long_t *v) arch_atomic_long_sub_and_test(long i, atomic_long_t *v)
{ {
return atomic64_sub_and_test(i, v); return arch_atomic64_sub_and_test(i, v);
} }
static __always_inline bool static __always_inline bool
atomic_long_dec_and_test(atomic_long_t *v) arch_atomic_long_dec_and_test(atomic_long_t *v)
{ {
return atomic64_dec_and_test(v); return arch_atomic64_dec_and_test(v);
} }
static __always_inline bool static __always_inline bool
atomic_long_inc_and_test(atomic_long_t *v) arch_atomic_long_inc_and_test(atomic_long_t *v)
{ {
return atomic64_inc_and_test(v); return arch_atomic64_inc_and_test(v);
} }
static __always_inline bool static __always_inline bool
atomic_long_add_negative(long i, atomic_long_t *v) arch_atomic_long_add_negative(long i, atomic_long_t *v)
{ {
return atomic64_add_negative(i, v); return arch_atomic64_add_negative(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_add_unless(atomic_long_t *v, long a, long u) arch_atomic_long_fetch_add_unless(atomic_long_t *v, long a, long u)
{ {
return atomic64_fetch_add_unless(v, a, u); return arch_atomic64_fetch_add_unless(v, a, u);
} }
static __always_inline bool static __always_inline bool
atomic_long_add_unless(atomic_long_t *v, long a, long u) arch_atomic_long_add_unless(atomic_long_t *v, long a, long u)
{ {
return atomic64_add_unless(v, a, u); return arch_atomic64_add_unless(v, a, u);
} }
static __always_inline bool static __always_inline bool
atomic_long_inc_not_zero(atomic_long_t *v) arch_atomic_long_inc_not_zero(atomic_long_t *v)
{ {
return atomic64_inc_not_zero(v); return arch_atomic64_inc_not_zero(v);
} }
static __always_inline bool static __always_inline bool
atomic_long_inc_unless_negative(atomic_long_t *v) arch_atomic_long_inc_unless_negative(atomic_long_t *v)
{ {
return atomic64_inc_unless_negative(v); return arch_atomic64_inc_unless_negative(v);
} }
static __always_inline bool static __always_inline bool
atomic_long_dec_unless_positive(atomic_long_t *v) arch_atomic_long_dec_unless_positive(atomic_long_t *v)
{ {
return atomic64_dec_unless_positive(v); return arch_atomic64_dec_unless_positive(v);
} }
static __always_inline long static __always_inline long
atomic_long_dec_if_positive(atomic_long_t *v) arch_atomic_long_dec_if_positive(atomic_long_t *v)
{ {
return atomic64_dec_if_positive(v); return arch_atomic64_dec_if_positive(v);
} }
#else /* CONFIG_64BIT */ #else /* CONFIG_64BIT */
static __always_inline long static __always_inline long
atomic_long_read(const atomic_long_t *v) arch_atomic_long_read(const atomic_long_t *v)
{ {
return atomic_read(v); return arch_atomic_read(v);
} }
static __always_inline long static __always_inline long
atomic_long_read_acquire(const atomic_long_t *v) arch_atomic_long_read_acquire(const atomic_long_t *v)
{ {
return atomic_read_acquire(v); return arch_atomic_read_acquire(v);
} }
static __always_inline void static __always_inline void
atomic_long_set(atomic_long_t *v, long i) arch_atomic_long_set(atomic_long_t *v, long i)
{ {
atomic_set(v, i); arch_atomic_set(v, i);
} }
static __always_inline void static __always_inline void
atomic_long_set_release(atomic_long_t *v, long i) arch_atomic_long_set_release(atomic_long_t *v, long i)
{ {
atomic_set_release(v, i); arch_atomic_set_release(v, i);
} }
static __always_inline void static __always_inline void
atomic_long_add(long i, atomic_long_t *v) arch_atomic_long_add(long i, atomic_long_t *v)
{ {
atomic_add(i, v); arch_atomic_add(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_add_return(long i, atomic_long_t *v) arch_atomic_long_add_return(long i, atomic_long_t *v)
{ {
return atomic_add_return(i, v); return arch_atomic_add_return(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_add_return_acquire(long i, atomic_long_t *v) arch_atomic_long_add_return_acquire(long i, atomic_long_t *v)
{ {
return atomic_add_return_acquire(i, v); return arch_atomic_add_return_acquire(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_add_return_release(long i, atomic_long_t *v) arch_atomic_long_add_return_release(long i, atomic_long_t *v)
{ {
return atomic_add_return_release(i, v); return arch_atomic_add_return_release(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_add_return_relaxed(long i, atomic_long_t *v) arch_atomic_long_add_return_relaxed(long i, atomic_long_t *v)
{ {
return atomic_add_return_relaxed(i, v); return arch_atomic_add_return_relaxed(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_add(long i, atomic_long_t *v) arch_atomic_long_fetch_add(long i, atomic_long_t *v)
{ {
return atomic_fetch_add(i, v); return arch_atomic_fetch_add(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_add_acquire(long i, atomic_long_t *v) arch_atomic_long_fetch_add_acquire(long i, atomic_long_t *v)
{ {
return atomic_fetch_add_acquire(i, v); return arch_atomic_fetch_add_acquire(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_add_release(long i, atomic_long_t *v) arch_atomic_long_fetch_add_release(long i, atomic_long_t *v)
{ {
return atomic_fetch_add_release(i, v); return arch_atomic_fetch_add_release(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_add_relaxed(long i, atomic_long_t *v) arch_atomic_long_fetch_add_relaxed(long i, atomic_long_t *v)
{ {
return atomic_fetch_add_relaxed(i, v); return arch_atomic_fetch_add_relaxed(i, v);
} }
static __always_inline void static __always_inline void
atomic_long_sub(long i, atomic_long_t *v) arch_atomic_long_sub(long i, atomic_long_t *v)
{ {
atomic_sub(i, v); arch_atomic_sub(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_sub_return(long i, atomic_long_t *v) arch_atomic_long_sub_return(long i, atomic_long_t *v)
{ {
return atomic_sub_return(i, v); return arch_atomic_sub_return(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_sub_return_acquire(long i, atomic_long_t *v) arch_atomic_long_sub_return_acquire(long i, atomic_long_t *v)
{ {
return atomic_sub_return_acquire(i, v); return arch_atomic_sub_return_acquire(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_sub_return_release(long i, atomic_long_t *v) arch_atomic_long_sub_return_release(long i, atomic_long_t *v)
{ {
return atomic_sub_return_release(i, v); return arch_atomic_sub_return_release(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_sub_return_relaxed(long i, atomic_long_t *v) arch_atomic_long_sub_return_relaxed(long i, atomic_long_t *v)
{ {
return atomic_sub_return_relaxed(i, v); return arch_atomic_sub_return_relaxed(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_sub(long i, atomic_long_t *v) arch_atomic_long_fetch_sub(long i, atomic_long_t *v)
{ {
return atomic_fetch_sub(i, v); return arch_atomic_fetch_sub(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_sub_acquire(long i, atomic_long_t *v) arch_atomic_long_fetch_sub_acquire(long i, atomic_long_t *v)
{ {
return atomic_fetch_sub_acquire(i, v); return arch_atomic_fetch_sub_acquire(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_sub_release(long i, atomic_long_t *v) arch_atomic_long_fetch_sub_release(long i, atomic_long_t *v)
{ {
return atomic_fetch_sub_release(i, v); return arch_atomic_fetch_sub_release(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_sub_relaxed(long i, atomic_long_t *v) arch_atomic_long_fetch_sub_relaxed(long i, atomic_long_t *v)
{ {
return atomic_fetch_sub_relaxed(i, v); return arch_atomic_fetch_sub_relaxed(i, v);
} }
static __always_inline void static __always_inline void
atomic_long_inc(atomic_long_t *v) arch_atomic_long_inc(atomic_long_t *v)
{ {
atomic_inc(v); arch_atomic_inc(v);
} }
static __always_inline long static __always_inline long
atomic_long_inc_return(atomic_long_t *v) arch_atomic_long_inc_return(atomic_long_t *v)
{ {
return atomic_inc_return(v); return arch_atomic_inc_return(v);
} }
static __always_inline long static __always_inline long
atomic_long_inc_return_acquire(atomic_long_t *v) arch_atomic_long_inc_return_acquire(atomic_long_t *v)
{ {
return atomic_inc_return_acquire(v); return arch_atomic_inc_return_acquire(v);
} }
static __always_inline long static __always_inline long
atomic_long_inc_return_release(atomic_long_t *v) arch_atomic_long_inc_return_release(atomic_long_t *v)
{ {
return atomic_inc_return_release(v); return arch_atomic_inc_return_release(v);
} }
static __always_inline long static __always_inline long
atomic_long_inc_return_relaxed(atomic_long_t *v) arch_atomic_long_inc_return_relaxed(atomic_long_t *v)
{ {
return atomic_inc_return_relaxed(v); return arch_atomic_inc_return_relaxed(v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_inc(atomic_long_t *v) arch_atomic_long_fetch_inc(atomic_long_t *v)
{ {
return atomic_fetch_inc(v); return arch_atomic_fetch_inc(v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_inc_acquire(atomic_long_t *v) arch_atomic_long_fetch_inc_acquire(atomic_long_t *v)
{ {
return atomic_fetch_inc_acquire(v); return arch_atomic_fetch_inc_acquire(v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_inc_release(atomic_long_t *v) arch_atomic_long_fetch_inc_release(atomic_long_t *v)
{ {
return atomic_fetch_inc_release(v); return arch_atomic_fetch_inc_release(v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_inc_relaxed(atomic_long_t *v) arch_atomic_long_fetch_inc_relaxed(atomic_long_t *v)
{ {
return atomic_fetch_inc_relaxed(v); return arch_atomic_fetch_inc_relaxed(v);
} }
static __always_inline void static __always_inline void
atomic_long_dec(atomic_long_t *v) arch_atomic_long_dec(atomic_long_t *v)
{ {
atomic_dec(v); arch_atomic_dec(v);
} }
static __always_inline long static __always_inline long
atomic_long_dec_return(atomic_long_t *v) arch_atomic_long_dec_return(atomic_long_t *v)
{ {
return atomic_dec_return(v); return arch_atomic_dec_return(v);
} }
static __always_inline long static __always_inline long
atomic_long_dec_return_acquire(atomic_long_t *v) arch_atomic_long_dec_return_acquire(atomic_long_t *v)
{ {
return atomic_dec_return_acquire(v); return arch_atomic_dec_return_acquire(v);
} }
static __always_inline long static __always_inline long
atomic_long_dec_return_release(atomic_long_t *v) arch_atomic_long_dec_return_release(atomic_long_t *v)
{ {
return atomic_dec_return_release(v); return arch_atomic_dec_return_release(v);
} }
static __always_inline long static __always_inline long
atomic_long_dec_return_relaxed(atomic_long_t *v) arch_atomic_long_dec_return_relaxed(atomic_long_t *v)
{ {
return atomic_dec_return_relaxed(v); return arch_atomic_dec_return_relaxed(v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_dec(atomic_long_t *v) arch_atomic_long_fetch_dec(atomic_long_t *v)
{ {
return atomic_fetch_dec(v); return arch_atomic_fetch_dec(v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_dec_acquire(atomic_long_t *v) arch_atomic_long_fetch_dec_acquire(atomic_long_t *v)
{ {
return atomic_fetch_dec_acquire(v); return arch_atomic_fetch_dec_acquire(v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_dec_release(atomic_long_t *v) arch_atomic_long_fetch_dec_release(atomic_long_t *v)
{ {
return atomic_fetch_dec_release(v); return arch_atomic_fetch_dec_release(v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_dec_relaxed(atomic_long_t *v) arch_atomic_long_fetch_dec_relaxed(atomic_long_t *v)
{ {
return atomic_fetch_dec_relaxed(v); return arch_atomic_fetch_dec_relaxed(v);
} }
static __always_inline void static __always_inline void
atomic_long_and(long i, atomic_long_t *v) arch_atomic_long_and(long i, atomic_long_t *v)
{ {
atomic_and(i, v); arch_atomic_and(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_and(long i, atomic_long_t *v) arch_atomic_long_fetch_and(long i, atomic_long_t *v)
{ {
return atomic_fetch_and(i, v); return arch_atomic_fetch_and(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_and_acquire(long i, atomic_long_t *v) arch_atomic_long_fetch_and_acquire(long i, atomic_long_t *v)
{ {
return atomic_fetch_and_acquire(i, v); return arch_atomic_fetch_and_acquire(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_and_release(long i, atomic_long_t *v) arch_atomic_long_fetch_and_release(long i, atomic_long_t *v)
{ {
return atomic_fetch_and_release(i, v); return arch_atomic_fetch_and_release(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_and_relaxed(long i, atomic_long_t *v) arch_atomic_long_fetch_and_relaxed(long i, atomic_long_t *v)
{ {
return atomic_fetch_and_relaxed(i, v); return arch_atomic_fetch_and_relaxed(i, v);
} }
static __always_inline void static __always_inline void
atomic_long_andnot(long i, atomic_long_t *v) arch_atomic_long_andnot(long i, atomic_long_t *v)
{ {
atomic_andnot(i, v); arch_atomic_andnot(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_andnot(long i, atomic_long_t *v) arch_atomic_long_fetch_andnot(long i, atomic_long_t *v)
{ {
return atomic_fetch_andnot(i, v); return arch_atomic_fetch_andnot(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_andnot_acquire(long i, atomic_long_t *v) arch_atomic_long_fetch_andnot_acquire(long i, atomic_long_t *v)
{ {
return atomic_fetch_andnot_acquire(i, v); return arch_atomic_fetch_andnot_acquire(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_andnot_release(long i, atomic_long_t *v) arch_atomic_long_fetch_andnot_release(long i, atomic_long_t *v)
{ {
return atomic_fetch_andnot_release(i, v); return arch_atomic_fetch_andnot_release(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_andnot_relaxed(long i, atomic_long_t *v) arch_atomic_long_fetch_andnot_relaxed(long i, atomic_long_t *v)
{ {
return atomic_fetch_andnot_relaxed(i, v); return arch_atomic_fetch_andnot_relaxed(i, v);
} }
static __always_inline void static __always_inline void
atomic_long_or(long i, atomic_long_t *v) arch_atomic_long_or(long i, atomic_long_t *v)
{ {
atomic_or(i, v); arch_atomic_or(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_or(long i, atomic_long_t *v) arch_atomic_long_fetch_or(long i, atomic_long_t *v)
{ {
return atomic_fetch_or(i, v); return arch_atomic_fetch_or(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_or_acquire(long i, atomic_long_t *v) arch_atomic_long_fetch_or_acquire(long i, atomic_long_t *v)
{ {
return atomic_fetch_or_acquire(i, v); return arch_atomic_fetch_or_acquire(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_or_release(long i, atomic_long_t *v) arch_atomic_long_fetch_or_release(long i, atomic_long_t *v)
{ {
return atomic_fetch_or_release(i, v); return arch_atomic_fetch_or_release(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_or_relaxed(long i, atomic_long_t *v) arch_atomic_long_fetch_or_relaxed(long i, atomic_long_t *v)
{ {
return atomic_fetch_or_relaxed(i, v); return arch_atomic_fetch_or_relaxed(i, v);
} }
static __always_inline void static __always_inline void
atomic_long_xor(long i, atomic_long_t *v) arch_atomic_long_xor(long i, atomic_long_t *v)
{ {
atomic_xor(i, v); arch_atomic_xor(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_xor(long i, atomic_long_t *v) arch_atomic_long_fetch_xor(long i, atomic_long_t *v)
{ {
return atomic_fetch_xor(i, v); return arch_atomic_fetch_xor(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_xor_acquire(long i, atomic_long_t *v) arch_atomic_long_fetch_xor_acquire(long i, atomic_long_t *v)
{ {
return atomic_fetch_xor_acquire(i, v); return arch_atomic_fetch_xor_acquire(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_xor_release(long i, atomic_long_t *v) arch_atomic_long_fetch_xor_release(long i, atomic_long_t *v)
{ {
return atomic_fetch_xor_release(i, v); return arch_atomic_fetch_xor_release(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_xor_relaxed(long i, atomic_long_t *v) arch_atomic_long_fetch_xor_relaxed(long i, atomic_long_t *v)
{ {
return atomic_fetch_xor_relaxed(i, v); return arch_atomic_fetch_xor_relaxed(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_xchg(atomic_long_t *v, long i) arch_atomic_long_xchg(atomic_long_t *v, long i)
{ {
return atomic_xchg(v, i); return arch_atomic_xchg(v, i);
} }
static __always_inline long static __always_inline long
atomic_long_xchg_acquire(atomic_long_t *v, long i) arch_atomic_long_xchg_acquire(atomic_long_t *v, long i)
{ {
return atomic_xchg_acquire(v, i); return arch_atomic_xchg_acquire(v, i);
} }
static __always_inline long static __always_inline long
atomic_long_xchg_release(atomic_long_t *v, long i) arch_atomic_long_xchg_release(atomic_long_t *v, long i)
{ {
return atomic_xchg_release(v, i); return arch_atomic_xchg_release(v, i);
} }
static __always_inline long static __always_inline long
atomic_long_xchg_relaxed(atomic_long_t *v, long i) arch_atomic_long_xchg_relaxed(atomic_long_t *v, long i)
{ {
return atomic_xchg_relaxed(v, i); return arch_atomic_xchg_relaxed(v, i);
} }
static __always_inline long static __always_inline long
atomic_long_cmpxchg(atomic_long_t *v, long old, long new) arch_atomic_long_cmpxchg(atomic_long_t *v, long old, long new)
{ {
return atomic_cmpxchg(v, old, new); return arch_atomic_cmpxchg(v, old, new);
} }
static __always_inline long static __always_inline long
atomic_long_cmpxchg_acquire(atomic_long_t *v, long old, long new) arch_atomic_long_cmpxchg_acquire(atomic_long_t *v, long old, long new)
{ {
return atomic_cmpxchg_acquire(v, old, new); return arch_atomic_cmpxchg_acquire(v, old, new);
} }
static __always_inline long static __always_inline long
atomic_long_cmpxchg_release(atomic_long_t *v, long old, long new) arch_atomic_long_cmpxchg_release(atomic_long_t *v, long old, long new)
{ {
return atomic_cmpxchg_release(v, old, new); return arch_atomic_cmpxchg_release(v, old, new);
} }
static __always_inline long static __always_inline long
atomic_long_cmpxchg_relaxed(atomic_long_t *v, long old, long new) arch_atomic_long_cmpxchg_relaxed(atomic_long_t *v, long old, long new)
{ {
return atomic_cmpxchg_relaxed(v, old, new); return arch_atomic_cmpxchg_relaxed(v, old, new);
} }
static __always_inline bool static __always_inline bool
atomic_long_try_cmpxchg(atomic_long_t *v, long *old, long new) arch_atomic_long_try_cmpxchg(atomic_long_t *v, long *old, long new)
{ {
return atomic_try_cmpxchg(v, (int *)old, new); return arch_atomic_try_cmpxchg(v, (int *)old, new);
} }
static __always_inline bool static __always_inline bool
atomic_long_try_cmpxchg_acquire(atomic_long_t *v, long *old, long new) arch_atomic_long_try_cmpxchg_acquire(atomic_long_t *v, long *old, long new)
{ {
return atomic_try_cmpxchg_acquire(v, (int *)old, new); return arch_atomic_try_cmpxchg_acquire(v, (int *)old, new);
} }
static __always_inline bool static __always_inline bool
atomic_long_try_cmpxchg_release(atomic_long_t *v, long *old, long new) arch_atomic_long_try_cmpxchg_release(atomic_long_t *v, long *old, long new)
{ {
return atomic_try_cmpxchg_release(v, (int *)old, new); return arch_atomic_try_cmpxchg_release(v, (int *)old, new);
} }
static __always_inline bool static __always_inline bool
atomic_long_try_cmpxchg_relaxed(atomic_long_t *v, long *old, long new) arch_atomic_long_try_cmpxchg_relaxed(atomic_long_t *v, long *old, long new)
{ {
return atomic_try_cmpxchg_relaxed(v, (int *)old, new); return arch_atomic_try_cmpxchg_relaxed(v, (int *)old, new);
} }
static __always_inline bool static __always_inline bool
atomic_long_sub_and_test(long i, atomic_long_t *v) arch_atomic_long_sub_and_test(long i, atomic_long_t *v)
{ {
return atomic_sub_and_test(i, v); return arch_atomic_sub_and_test(i, v);
} }
static __always_inline bool static __always_inline bool
atomic_long_dec_and_test(atomic_long_t *v) arch_atomic_long_dec_and_test(atomic_long_t *v)
{ {
return atomic_dec_and_test(v); return arch_atomic_dec_and_test(v);
} }
static __always_inline bool static __always_inline bool
atomic_long_inc_and_test(atomic_long_t *v) arch_atomic_long_inc_and_test(atomic_long_t *v)
{ {
return atomic_inc_and_test(v); return arch_atomic_inc_and_test(v);
} }
static __always_inline bool static __always_inline bool
atomic_long_add_negative(long i, atomic_long_t *v) arch_atomic_long_add_negative(long i, atomic_long_t *v)
{ {
return atomic_add_negative(i, v); return arch_atomic_add_negative(i, v);
} }
static __always_inline long static __always_inline long
atomic_long_fetch_add_unless(atomic_long_t *v, long a, long u) arch_atomic_long_fetch_add_unless(atomic_long_t *v, long a, long u)
{ {
return atomic_fetch_add_unless(v, a, u); return arch_atomic_fetch_add_unless(v, a, u);
} }
static __always_inline bool static __always_inline bool
atomic_long_add_unless(atomic_long_t *v, long a, long u) arch_atomic_long_add_unless(atomic_long_t *v, long a, long u)
{ {
return atomic_add_unless(v, a, u); return arch_atomic_add_unless(v, a, u);
} }
static __always_inline bool static __always_inline bool
atomic_long_inc_not_zero(atomic_long_t *v) arch_atomic_long_inc_not_zero(atomic_long_t *v)
{ {
return atomic_inc_not_zero(v); return arch_atomic_inc_not_zero(v);
} }
static __always_inline bool static __always_inline bool
atomic_long_inc_unless_negative(atomic_long_t *v) arch_atomic_long_inc_unless_negative(atomic_long_t *v)
{ {
return atomic_inc_unless_negative(v); return arch_atomic_inc_unless_negative(v);
} }
static __always_inline bool static __always_inline bool
atomic_long_dec_unless_positive(atomic_long_t *v) arch_atomic_long_dec_unless_positive(atomic_long_t *v)
{ {
return atomic_dec_unless_positive(v); return arch_atomic_dec_unless_positive(v);
} }
static __always_inline long static __always_inline long
atomic_long_dec_if_positive(atomic_long_t *v) arch_atomic_long_dec_if_positive(atomic_long_t *v)
{ {
return atomic_dec_if_positive(v); return arch_atomic_dec_if_positive(v);
} }
#endif /* CONFIG_64BIT */ #endif /* CONFIG_64BIT */
#endif /* _LINUX_ATOMIC_LONG_H */ #endif /* _LINUX_ATOMIC_LONG_H */
// c5552b5d78a0c7584dfd03cba985e78a1a86bbed // e8f0e08ff072b74d180eabe2ad001282b38c2c88
...@@ -138,6 +138,11 @@ grep '^[a-z]' "$1" | while read name meta args; do ...@@ -138,6 +138,11 @@ grep '^[a-z]' "$1" | while read name meta args; do
gen_proto "${meta}" "${name}" "atomic64" "s64" ${args} gen_proto "${meta}" "${name}" "atomic64" "s64" ${args}
done done
grep '^[a-z]' "$1" | while read name meta args; do
gen_proto "${meta}" "${name}" "atomic_long" "long" ${args}
done
for xchg in "xchg" "cmpxchg" "cmpxchg64" "try_cmpxchg"; do for xchg in "xchg" "cmpxchg" "cmpxchg64" "try_cmpxchg"; do
for order in "" "_acquire" "_release" "_relaxed"; do for order in "" "_acquire" "_release" "_relaxed"; do
gen_xchg "${xchg}${order}" "" gen_xchg "${xchg}${order}" ""
......
...@@ -47,9 +47,9 @@ gen_proto_order_variant() ...@@ -47,9 +47,9 @@ gen_proto_order_variant()
cat <<EOF cat <<EOF
static __always_inline ${ret} static __always_inline ${ret}
atomic_long_${name}(${params}) arch_atomic_long_${name}(${params})
{ {
${retstmt}${atomic}_${name}(${argscast}); ${retstmt}arch_${atomic}_${name}(${argscast});
} }
EOF EOF
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment