/** * raw_atomic_read() - atomic load with relaxed ordering * @v: pointer to atomic_t * * Atomically loads the value of @v with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_read() elsewhere. * * Return: The value loaded from @v.
*/ static __always_inline int
raw_atomic_read(const atomic_t *v)
{ return arch_atomic_read(v);
}
/** * raw_atomic_read_acquire() - atomic load with acquire ordering * @v: pointer to atomic_t * * Atomically loads the value of @v with acquire ordering. * * Safe to use in noinstr code; prefer atomic_read_acquire() elsewhere. * * Return: The value loaded from @v.
*/ static __always_inline int
raw_atomic_read_acquire(const atomic_t *v)
{ #ifdefined(arch_atomic_read_acquire) return arch_atomic_read_acquire(v); #else int ret;
if (__native_word(atomic_t)) {
ret = smp_load_acquire(&(v)->counter);
} else {
ret = raw_atomic_read(v);
__atomic_acquire_fence();
}
return ret; #endif
}
/** * raw_atomic_set() - atomic set with relaxed ordering * @v: pointer to atomic_t * @i: int value to assign * * Atomically sets @v to @i with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_set() elsewhere. * * Return: Nothing.
*/ static __always_inline void
raw_atomic_set(atomic_t *v, int i)
{
arch_atomic_set(v, i);
}
/** * raw_atomic_set_release() - atomic set with release ordering * @v: pointer to atomic_t * @i: int value to assign * * Atomically sets @v to @i with release ordering. * * Safe to use in noinstr code; prefer atomic_set_release() elsewhere. * * Return: Nothing.
*/ static __always_inline void
raw_atomic_set_release(atomic_t *v, int i)
{ #ifdefined(arch_atomic_set_release)
arch_atomic_set_release(v, i); #else if (__native_word(atomic_t)) {
smp_store_release(&(v)->counter, i);
} else {
__atomic_release_fence();
raw_atomic_set(v, i);
} #endif
}
/** * raw_atomic_add() - atomic add with relaxed ordering * @i: int value to add * @v: pointer to atomic_t * * Atomically updates @v to (@v + @i) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_add() elsewhere. * * Return: Nothing.
*/ static __always_inline void
raw_atomic_add(int i, atomic_t *v)
{
arch_atomic_add(i, v);
}
/** * raw_atomic_add_return() - atomic add with full ordering * @i: int value to add * @v: pointer to atomic_t * * Atomically updates @v to (@v + @i) with full ordering. * * Safe to use in noinstr code; prefer atomic_add_return() elsewhere. * * Return: The updated value of @v.
*/ static __always_inline int
raw_atomic_add_return(int i, atomic_t *v)
{ #ifdefined(arch_atomic_add_return) return arch_atomic_add_return(i, v); #elifdefined(arch_atomic_add_return_relaxed) int ret;
__atomic_pre_full_fence();
ret = arch_atomic_add_return_relaxed(i, v);
__atomic_post_full_fence(); return ret; #else #error"Unable to define raw_atomic_add_return" #endif
}
/** * raw_atomic_add_return_acquire() - atomic add with acquire ordering * @i: int value to add * @v: pointer to atomic_t * * Atomically updates @v to (@v + @i) with acquire ordering. * * Safe to use in noinstr code; prefer atomic_add_return_acquire() elsewhere. * * Return: The updated value of @v.
*/ static __always_inline int
raw_atomic_add_return_acquire(int i, atomic_t *v)
{ #ifdefined(arch_atomic_add_return_acquire) return arch_atomic_add_return_acquire(i, v); #elifdefined(arch_atomic_add_return_relaxed) int ret = arch_atomic_add_return_relaxed(i, v);
__atomic_acquire_fence(); return ret; #elifdefined(arch_atomic_add_return) return arch_atomic_add_return(i, v); #else #error"Unable to define raw_atomic_add_return_acquire" #endif
}
/** * raw_atomic_add_return_release() - atomic add with release ordering * @i: int value to add * @v: pointer to atomic_t * * Atomically updates @v to (@v + @i) with release ordering. * * Safe to use in noinstr code; prefer atomic_add_return_release() elsewhere. * * Return: The updated value of @v.
*/ static __always_inline int
raw_atomic_add_return_release(int i, atomic_t *v)
{ #ifdefined(arch_atomic_add_return_release) return arch_atomic_add_return_release(i, v); #elifdefined(arch_atomic_add_return_relaxed)
__atomic_release_fence(); return arch_atomic_add_return_relaxed(i, v); #elifdefined(arch_atomic_add_return) return arch_atomic_add_return(i, v); #else #error"Unable to define raw_atomic_add_return_release" #endif
}
/** * raw_atomic_add_return_relaxed() - atomic add with relaxed ordering * @i: int value to add * @v: pointer to atomic_t * * Atomically updates @v to (@v + @i) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_add_return_relaxed() elsewhere. * * Return: The updated value of @v.
*/ static __always_inline int
raw_atomic_add_return_relaxed(int i, atomic_t *v)
{ #ifdefined(arch_atomic_add_return_relaxed) return arch_atomic_add_return_relaxed(i, v); #elifdefined(arch_atomic_add_return) return arch_atomic_add_return(i, v); #else #error"Unable to define raw_atomic_add_return_relaxed" #endif
}
/** * raw_atomic_fetch_add() - atomic add with full ordering * @i: int value to add * @v: pointer to atomic_t * * Atomically updates @v to (@v + @i) with full ordering. * * Safe to use in noinstr code; prefer atomic_fetch_add() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_add(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_add) return arch_atomic_fetch_add(i, v); #elifdefined(arch_atomic_fetch_add_relaxed) int ret;
__atomic_pre_full_fence();
ret = arch_atomic_fetch_add_relaxed(i, v);
__atomic_post_full_fence(); return ret; #else #error"Unable to define raw_atomic_fetch_add" #endif
}
/** * raw_atomic_fetch_add_acquire() - atomic add with acquire ordering * @i: int value to add * @v: pointer to atomic_t * * Atomically updates @v to (@v + @i) with acquire ordering. * * Safe to use in noinstr code; prefer atomic_fetch_add_acquire() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_add_acquire(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_add_acquire) return arch_atomic_fetch_add_acquire(i, v); #elifdefined(arch_atomic_fetch_add_relaxed) int ret = arch_atomic_fetch_add_relaxed(i, v);
__atomic_acquire_fence(); return ret; #elifdefined(arch_atomic_fetch_add) return arch_atomic_fetch_add(i, v); #else #error"Unable to define raw_atomic_fetch_add_acquire" #endif
}
/** * raw_atomic_fetch_add_release() - atomic add with release ordering * @i: int value to add * @v: pointer to atomic_t * * Atomically updates @v to (@v + @i) with release ordering. * * Safe to use in noinstr code; prefer atomic_fetch_add_release() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_add_release(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_add_release) return arch_atomic_fetch_add_release(i, v); #elifdefined(arch_atomic_fetch_add_relaxed)
__atomic_release_fence(); return arch_atomic_fetch_add_relaxed(i, v); #elifdefined(arch_atomic_fetch_add) return arch_atomic_fetch_add(i, v); #else #error"Unable to define raw_atomic_fetch_add_release" #endif
}
/** * raw_atomic_fetch_add_relaxed() - atomic add with relaxed ordering * @i: int value to add * @v: pointer to atomic_t * * Atomically updates @v to (@v + @i) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_fetch_add_relaxed() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_add_relaxed(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_add_relaxed) return arch_atomic_fetch_add_relaxed(i, v); #elifdefined(arch_atomic_fetch_add) return arch_atomic_fetch_add(i, v); #else #error"Unable to define raw_atomic_fetch_add_relaxed" #endif
}
/** * raw_atomic_sub() - atomic subtract with relaxed ordering * @i: int value to subtract * @v: pointer to atomic_t * * Atomically updates @v to (@v - @i) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_sub() elsewhere. * * Return: Nothing.
*/ static __always_inline void
raw_atomic_sub(int i, atomic_t *v)
{
arch_atomic_sub(i, v);
}
/** * raw_atomic_sub_return() - atomic subtract with full ordering * @i: int value to subtract * @v: pointer to atomic_t * * Atomically updates @v to (@v - @i) with full ordering. * * Safe to use in noinstr code; prefer atomic_sub_return() elsewhere. * * Return: The updated value of @v.
*/ static __always_inline int
raw_atomic_sub_return(int i, atomic_t *v)
{ #ifdefined(arch_atomic_sub_return) return arch_atomic_sub_return(i, v); #elifdefined(arch_atomic_sub_return_relaxed) int ret;
__atomic_pre_full_fence();
ret = arch_atomic_sub_return_relaxed(i, v);
__atomic_post_full_fence(); return ret; #else #error"Unable to define raw_atomic_sub_return" #endif
}
/** * raw_atomic_sub_return_acquire() - atomic subtract with acquire ordering * @i: int value to subtract * @v: pointer to atomic_t * * Atomically updates @v to (@v - @i) with acquire ordering. * * Safe to use in noinstr code; prefer atomic_sub_return_acquire() elsewhere. * * Return: The updated value of @v.
*/ static __always_inline int
raw_atomic_sub_return_acquire(int i, atomic_t *v)
{ #ifdefined(arch_atomic_sub_return_acquire) return arch_atomic_sub_return_acquire(i, v); #elifdefined(arch_atomic_sub_return_relaxed) int ret = arch_atomic_sub_return_relaxed(i, v);
__atomic_acquire_fence(); return ret; #elifdefined(arch_atomic_sub_return) return arch_atomic_sub_return(i, v); #else #error"Unable to define raw_atomic_sub_return_acquire" #endif
}
/** * raw_atomic_sub_return_release() - atomic subtract with release ordering * @i: int value to subtract * @v: pointer to atomic_t * * Atomically updates @v to (@v - @i) with release ordering. * * Safe to use in noinstr code; prefer atomic_sub_return_release() elsewhere. * * Return: The updated value of @v.
*/ static __always_inline int
raw_atomic_sub_return_release(int i, atomic_t *v)
{ #ifdefined(arch_atomic_sub_return_release) return arch_atomic_sub_return_release(i, v); #elifdefined(arch_atomic_sub_return_relaxed)
__atomic_release_fence(); return arch_atomic_sub_return_relaxed(i, v); #elifdefined(arch_atomic_sub_return) return arch_atomic_sub_return(i, v); #else #error"Unable to define raw_atomic_sub_return_release" #endif
}
/** * raw_atomic_sub_return_relaxed() - atomic subtract with relaxed ordering * @i: int value to subtract * @v: pointer to atomic_t * * Atomically updates @v to (@v - @i) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_sub_return_relaxed() elsewhere. * * Return: The updated value of @v.
*/ static __always_inline int
raw_atomic_sub_return_relaxed(int i, atomic_t *v)
{ #ifdefined(arch_atomic_sub_return_relaxed) return arch_atomic_sub_return_relaxed(i, v); #elifdefined(arch_atomic_sub_return) return arch_atomic_sub_return(i, v); #else #error"Unable to define raw_atomic_sub_return_relaxed" #endif
}
/** * raw_atomic_fetch_sub() - atomic subtract with full ordering * @i: int value to subtract * @v: pointer to atomic_t * * Atomically updates @v to (@v - @i) with full ordering. * * Safe to use in noinstr code; prefer atomic_fetch_sub() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_sub(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_sub) return arch_atomic_fetch_sub(i, v); #elifdefined(arch_atomic_fetch_sub_relaxed) int ret;
__atomic_pre_full_fence();
ret = arch_atomic_fetch_sub_relaxed(i, v);
__atomic_post_full_fence(); return ret; #else #error"Unable to define raw_atomic_fetch_sub" #endif
}
/** * raw_atomic_fetch_sub_acquire() - atomic subtract with acquire ordering * @i: int value to subtract * @v: pointer to atomic_t * * Atomically updates @v to (@v - @i) with acquire ordering. * * Safe to use in noinstr code; prefer atomic_fetch_sub_acquire() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_sub_acquire(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_sub_acquire) return arch_atomic_fetch_sub_acquire(i, v); #elifdefined(arch_atomic_fetch_sub_relaxed) int ret = arch_atomic_fetch_sub_relaxed(i, v);
__atomic_acquire_fence(); return ret; #elifdefined(arch_atomic_fetch_sub) return arch_atomic_fetch_sub(i, v); #else #error"Unable to define raw_atomic_fetch_sub_acquire" #endif
}
/** * raw_atomic_fetch_sub_release() - atomic subtract with release ordering * @i: int value to subtract * @v: pointer to atomic_t * * Atomically updates @v to (@v - @i) with release ordering. * * Safe to use in noinstr code; prefer atomic_fetch_sub_release() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_sub_release(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_sub_release) return arch_atomic_fetch_sub_release(i, v); #elifdefined(arch_atomic_fetch_sub_relaxed)
__atomic_release_fence(); return arch_atomic_fetch_sub_relaxed(i, v); #elifdefined(arch_atomic_fetch_sub) return arch_atomic_fetch_sub(i, v); #else #error"Unable to define raw_atomic_fetch_sub_release" #endif
}
/** * raw_atomic_fetch_sub_relaxed() - atomic subtract with relaxed ordering * @i: int value to subtract * @v: pointer to atomic_t * * Atomically updates @v to (@v - @i) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_fetch_sub_relaxed() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_sub_relaxed(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_sub_relaxed) return arch_atomic_fetch_sub_relaxed(i, v); #elifdefined(arch_atomic_fetch_sub) return arch_atomic_fetch_sub(i, v); #else #error"Unable to define raw_atomic_fetch_sub_relaxed" #endif
}
/** * raw_atomic_inc() - atomic increment with relaxed ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v + 1) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_inc() elsewhere. * * Return: Nothing.
*/ static __always_inline void
raw_atomic_inc(atomic_t *v)
{ #ifdefined(arch_atomic_inc)
arch_atomic_inc(v); #else
raw_atomic_add(1, v); #endif
}
/** * raw_atomic_inc_return() - atomic increment with full ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v + 1) with full ordering. * * Safe to use in noinstr code; prefer atomic_inc_return() elsewhere. * * Return: The updated value of @v.
*/ static __always_inline int
raw_atomic_inc_return(atomic_t *v)
{ #ifdefined(arch_atomic_inc_return) return arch_atomic_inc_return(v); #elifdefined(arch_atomic_inc_return_relaxed) int ret;
__atomic_pre_full_fence();
ret = arch_atomic_inc_return_relaxed(v);
__atomic_post_full_fence(); return ret; #else return raw_atomic_add_return(1, v); #endif
}
/** * raw_atomic_inc_return_acquire() - atomic increment with acquire ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v + 1) with acquire ordering. * * Safe to use in noinstr code; prefer atomic_inc_return_acquire() elsewhere. * * Return: The updated value of @v.
*/ static __always_inline int
raw_atomic_inc_return_acquire(atomic_t *v)
{ #ifdefined(arch_atomic_inc_return_acquire) return arch_atomic_inc_return_acquire(v); #elifdefined(arch_atomic_inc_return_relaxed) int ret = arch_atomic_inc_return_relaxed(v);
__atomic_acquire_fence(); return ret; #elifdefined(arch_atomic_inc_return) return arch_atomic_inc_return(v); #else return raw_atomic_add_return_acquire(1, v); #endif
}
/** * raw_atomic_inc_return_release() - atomic increment with release ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v + 1) with release ordering. * * Safe to use in noinstr code; prefer atomic_inc_return_release() elsewhere. * * Return: The updated value of @v.
*/ static __always_inline int
raw_atomic_inc_return_release(atomic_t *v)
{ #ifdefined(arch_atomic_inc_return_release) return arch_atomic_inc_return_release(v); #elifdefined(arch_atomic_inc_return_relaxed)
__atomic_release_fence(); return arch_atomic_inc_return_relaxed(v); #elifdefined(arch_atomic_inc_return) return arch_atomic_inc_return(v); #else return raw_atomic_add_return_release(1, v); #endif
}
/** * raw_atomic_inc_return_relaxed() - atomic increment with relaxed ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v + 1) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_inc_return_relaxed() elsewhere. * * Return: The updated value of @v.
*/ static __always_inline int
raw_atomic_inc_return_relaxed(atomic_t *v)
{ #ifdefined(arch_atomic_inc_return_relaxed) return arch_atomic_inc_return_relaxed(v); #elifdefined(arch_atomic_inc_return) return arch_atomic_inc_return(v); #else return raw_atomic_add_return_relaxed(1, v); #endif
}
/** * raw_atomic_fetch_inc() - atomic increment with full ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v + 1) with full ordering. * * Safe to use in noinstr code; prefer atomic_fetch_inc() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_inc(atomic_t *v)
{ #ifdefined(arch_atomic_fetch_inc) return arch_atomic_fetch_inc(v); #elifdefined(arch_atomic_fetch_inc_relaxed) int ret;
__atomic_pre_full_fence();
ret = arch_atomic_fetch_inc_relaxed(v);
__atomic_post_full_fence(); return ret; #else return raw_atomic_fetch_add(1, v); #endif
}
/** * raw_atomic_fetch_inc_acquire() - atomic increment with acquire ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v + 1) with acquire ordering. * * Safe to use in noinstr code; prefer atomic_fetch_inc_acquire() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_inc_acquire(atomic_t *v)
{ #ifdefined(arch_atomic_fetch_inc_acquire) return arch_atomic_fetch_inc_acquire(v); #elifdefined(arch_atomic_fetch_inc_relaxed) int ret = arch_atomic_fetch_inc_relaxed(v);
__atomic_acquire_fence(); return ret; #elifdefined(arch_atomic_fetch_inc) return arch_atomic_fetch_inc(v); #else return raw_atomic_fetch_add_acquire(1, v); #endif
}
/** * raw_atomic_fetch_inc_release() - atomic increment with release ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v + 1) with release ordering. * * Safe to use in noinstr code; prefer atomic_fetch_inc_release() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_inc_release(atomic_t *v)
{ #ifdefined(arch_atomic_fetch_inc_release) return arch_atomic_fetch_inc_release(v); #elifdefined(arch_atomic_fetch_inc_relaxed)
__atomic_release_fence(); return arch_atomic_fetch_inc_relaxed(v); #elifdefined(arch_atomic_fetch_inc) return arch_atomic_fetch_inc(v); #else return raw_atomic_fetch_add_release(1, v); #endif
}
/** * raw_atomic_fetch_inc_relaxed() - atomic increment with relaxed ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v + 1) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_fetch_inc_relaxed() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_inc_relaxed(atomic_t *v)
{ #ifdefined(arch_atomic_fetch_inc_relaxed) return arch_atomic_fetch_inc_relaxed(v); #elifdefined(arch_atomic_fetch_inc) return arch_atomic_fetch_inc(v); #else return raw_atomic_fetch_add_relaxed(1, v); #endif
}
/** * raw_atomic_dec() - atomic decrement with relaxed ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v - 1) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_dec() elsewhere. * * Return: Nothing.
*/ static __always_inline void
raw_atomic_dec(atomic_t *v)
{ #ifdefined(arch_atomic_dec)
arch_atomic_dec(v); #else
raw_atomic_sub(1, v); #endif
}
/** * raw_atomic_dec_return() - atomic decrement with full ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v - 1) with full ordering. * * Safe to use in noinstr code; prefer atomic_dec_return() elsewhere. * * Return: The updated value of @v.
*/ static __always_inline int
raw_atomic_dec_return(atomic_t *v)
{ #ifdefined(arch_atomic_dec_return) return arch_atomic_dec_return(v); #elifdefined(arch_atomic_dec_return_relaxed) int ret;
__atomic_pre_full_fence();
ret = arch_atomic_dec_return_relaxed(v);
__atomic_post_full_fence(); return ret; #else return raw_atomic_sub_return(1, v); #endif
}
/** * raw_atomic_dec_return_acquire() - atomic decrement with acquire ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v - 1) with acquire ordering. * * Safe to use in noinstr code; prefer atomic_dec_return_acquire() elsewhere. * * Return: The updated value of @v.
*/ static __always_inline int
raw_atomic_dec_return_acquire(atomic_t *v)
{ #ifdefined(arch_atomic_dec_return_acquire) return arch_atomic_dec_return_acquire(v); #elifdefined(arch_atomic_dec_return_relaxed) int ret = arch_atomic_dec_return_relaxed(v);
__atomic_acquire_fence(); return ret; #elifdefined(arch_atomic_dec_return) return arch_atomic_dec_return(v); #else return raw_atomic_sub_return_acquire(1, v); #endif
}
/** * raw_atomic_dec_return_release() - atomic decrement with release ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v - 1) with release ordering. * * Safe to use in noinstr code; prefer atomic_dec_return_release() elsewhere. * * Return: The updated value of @v.
*/ static __always_inline int
raw_atomic_dec_return_release(atomic_t *v)
{ #ifdefined(arch_atomic_dec_return_release) return arch_atomic_dec_return_release(v); #elifdefined(arch_atomic_dec_return_relaxed)
__atomic_release_fence(); return arch_atomic_dec_return_relaxed(v); #elifdefined(arch_atomic_dec_return) return arch_atomic_dec_return(v); #else return raw_atomic_sub_return_release(1, v); #endif
}
/** * raw_atomic_dec_return_relaxed() - atomic decrement with relaxed ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v - 1) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_dec_return_relaxed() elsewhere. * * Return: The updated value of @v.
*/ static __always_inline int
raw_atomic_dec_return_relaxed(atomic_t *v)
{ #ifdefined(arch_atomic_dec_return_relaxed) return arch_atomic_dec_return_relaxed(v); #elifdefined(arch_atomic_dec_return) return arch_atomic_dec_return(v); #else return raw_atomic_sub_return_relaxed(1, v); #endif
}
/** * raw_atomic_fetch_dec() - atomic decrement with full ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v - 1) with full ordering. * * Safe to use in noinstr code; prefer atomic_fetch_dec() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_dec(atomic_t *v)
{ #ifdefined(arch_atomic_fetch_dec) return arch_atomic_fetch_dec(v); #elifdefined(arch_atomic_fetch_dec_relaxed) int ret;
__atomic_pre_full_fence();
ret = arch_atomic_fetch_dec_relaxed(v);
__atomic_post_full_fence(); return ret; #else return raw_atomic_fetch_sub(1, v); #endif
}
/** * raw_atomic_fetch_dec_acquire() - atomic decrement with acquire ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v - 1) with acquire ordering. * * Safe to use in noinstr code; prefer atomic_fetch_dec_acquire() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_dec_acquire(atomic_t *v)
{ #ifdefined(arch_atomic_fetch_dec_acquire) return arch_atomic_fetch_dec_acquire(v); #elifdefined(arch_atomic_fetch_dec_relaxed) int ret = arch_atomic_fetch_dec_relaxed(v);
__atomic_acquire_fence(); return ret; #elifdefined(arch_atomic_fetch_dec) return arch_atomic_fetch_dec(v); #else return raw_atomic_fetch_sub_acquire(1, v); #endif
}
/** * raw_atomic_fetch_dec_release() - atomic decrement with release ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v - 1) with release ordering. * * Safe to use in noinstr code; prefer atomic_fetch_dec_release() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_dec_release(atomic_t *v)
{ #ifdefined(arch_atomic_fetch_dec_release) return arch_atomic_fetch_dec_release(v); #elifdefined(arch_atomic_fetch_dec_relaxed)
__atomic_release_fence(); return arch_atomic_fetch_dec_relaxed(v); #elifdefined(arch_atomic_fetch_dec) return arch_atomic_fetch_dec(v); #else return raw_atomic_fetch_sub_release(1, v); #endif
}
/** * raw_atomic_fetch_dec_relaxed() - atomic decrement with relaxed ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v - 1) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_fetch_dec_relaxed() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_dec_relaxed(atomic_t *v)
{ #ifdefined(arch_atomic_fetch_dec_relaxed) return arch_atomic_fetch_dec_relaxed(v); #elifdefined(arch_atomic_fetch_dec) return arch_atomic_fetch_dec(v); #else return raw_atomic_fetch_sub_relaxed(1, v); #endif
}
/** * raw_atomic_and() - atomic bitwise AND with relaxed ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v & @i) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_and() elsewhere. * * Return: Nothing.
*/ static __always_inline void
raw_atomic_and(int i, atomic_t *v)
{
arch_atomic_and(i, v);
}
/** * raw_atomic_fetch_and() - atomic bitwise AND with full ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v & @i) with full ordering. * * Safe to use in noinstr code; prefer atomic_fetch_and() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_and(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_and) return arch_atomic_fetch_and(i, v); #elifdefined(arch_atomic_fetch_and_relaxed) int ret;
__atomic_pre_full_fence();
ret = arch_atomic_fetch_and_relaxed(i, v);
__atomic_post_full_fence(); return ret; #else #error"Unable to define raw_atomic_fetch_and" #endif
}
/** * raw_atomic_fetch_and_acquire() - atomic bitwise AND with acquire ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v & @i) with acquire ordering. * * Safe to use in noinstr code; prefer atomic_fetch_and_acquire() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_and_acquire(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_and_acquire) return arch_atomic_fetch_and_acquire(i, v); #elifdefined(arch_atomic_fetch_and_relaxed) int ret = arch_atomic_fetch_and_relaxed(i, v);
__atomic_acquire_fence(); return ret; #elifdefined(arch_atomic_fetch_and) return arch_atomic_fetch_and(i, v); #else #error"Unable to define raw_atomic_fetch_and_acquire" #endif
}
/** * raw_atomic_fetch_and_release() - atomic bitwise AND with release ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v & @i) with release ordering. * * Safe to use in noinstr code; prefer atomic_fetch_and_release() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_and_release(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_and_release) return arch_atomic_fetch_and_release(i, v); #elifdefined(arch_atomic_fetch_and_relaxed)
__atomic_release_fence(); return arch_atomic_fetch_and_relaxed(i, v); #elifdefined(arch_atomic_fetch_and) return arch_atomic_fetch_and(i, v); #else #error"Unable to define raw_atomic_fetch_and_release" #endif
}
/** * raw_atomic_fetch_and_relaxed() - atomic bitwise AND with relaxed ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v & @i) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_fetch_and_relaxed() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_and_relaxed(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_and_relaxed) return arch_atomic_fetch_and_relaxed(i, v); #elifdefined(arch_atomic_fetch_and) return arch_atomic_fetch_and(i, v); #else #error"Unable to define raw_atomic_fetch_and_relaxed" #endif
}
/** * raw_atomic_andnot() - atomic bitwise AND NOT with relaxed ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v & ~@i) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_andnot() elsewhere. * * Return: Nothing.
*/ static __always_inline void
raw_atomic_andnot(int i, atomic_t *v)
{ #ifdefined(arch_atomic_andnot)
arch_atomic_andnot(i, v); #else
raw_atomic_and(~i, v); #endif
}
/** * raw_atomic_fetch_andnot() - atomic bitwise AND NOT with full ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v & ~@i) with full ordering. * * Safe to use in noinstr code; prefer atomic_fetch_andnot() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_andnot(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_andnot) return arch_atomic_fetch_andnot(i, v); #elifdefined(arch_atomic_fetch_andnot_relaxed) int ret;
__atomic_pre_full_fence();
ret = arch_atomic_fetch_andnot_relaxed(i, v);
__atomic_post_full_fence(); return ret; #else return raw_atomic_fetch_and(~i, v); #endif
}
/** * raw_atomic_fetch_andnot_acquire() - atomic bitwise AND NOT with acquire ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v & ~@i) with acquire ordering. * * Safe to use in noinstr code; prefer atomic_fetch_andnot_acquire() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_andnot_acquire(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_andnot_acquire) return arch_atomic_fetch_andnot_acquire(i, v); #elifdefined(arch_atomic_fetch_andnot_relaxed) int ret = arch_atomic_fetch_andnot_relaxed(i, v);
__atomic_acquire_fence(); return ret; #elifdefined(arch_atomic_fetch_andnot) return arch_atomic_fetch_andnot(i, v); #else return raw_atomic_fetch_and_acquire(~i, v); #endif
}
/** * raw_atomic_fetch_andnot_release() - atomic bitwise AND NOT with release ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v & ~@i) with release ordering. * * Safe to use in noinstr code; prefer atomic_fetch_andnot_release() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_andnot_release(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_andnot_release) return arch_atomic_fetch_andnot_release(i, v); #elifdefined(arch_atomic_fetch_andnot_relaxed)
__atomic_release_fence(); return arch_atomic_fetch_andnot_relaxed(i, v); #elifdefined(arch_atomic_fetch_andnot) return arch_atomic_fetch_andnot(i, v); #else return raw_atomic_fetch_and_release(~i, v); #endif
}
/** * raw_atomic_fetch_andnot_relaxed() - atomic bitwise AND NOT with relaxed ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v & ~@i) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_fetch_andnot_relaxed() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_andnot_relaxed(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_andnot_relaxed) return arch_atomic_fetch_andnot_relaxed(i, v); #elifdefined(arch_atomic_fetch_andnot) return arch_atomic_fetch_andnot(i, v); #else return raw_atomic_fetch_and_relaxed(~i, v); #endif
}
/** * raw_atomic_or() - atomic bitwise OR with relaxed ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v | @i) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_or() elsewhere. * * Return: Nothing.
*/ static __always_inline void
raw_atomic_or(int i, atomic_t *v)
{
arch_atomic_or(i, v);
}
/** * raw_atomic_fetch_or() - atomic bitwise OR with full ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v | @i) with full ordering. * * Safe to use in noinstr code; prefer atomic_fetch_or() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_or(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_or) return arch_atomic_fetch_or(i, v); #elifdefined(arch_atomic_fetch_or_relaxed) int ret;
__atomic_pre_full_fence();
ret = arch_atomic_fetch_or_relaxed(i, v);
__atomic_post_full_fence(); return ret; #else #error"Unable to define raw_atomic_fetch_or" #endif
}
/** * raw_atomic_fetch_or_acquire() - atomic bitwise OR with acquire ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v | @i) with acquire ordering. * * Safe to use in noinstr code; prefer atomic_fetch_or_acquire() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_or_acquire(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_or_acquire) return arch_atomic_fetch_or_acquire(i, v); #elifdefined(arch_atomic_fetch_or_relaxed) int ret = arch_atomic_fetch_or_relaxed(i, v);
__atomic_acquire_fence(); return ret; #elifdefined(arch_atomic_fetch_or) return arch_atomic_fetch_or(i, v); #else #error"Unable to define raw_atomic_fetch_or_acquire" #endif
}
/** * raw_atomic_fetch_or_release() - atomic bitwise OR with release ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v | @i) with release ordering. * * Safe to use in noinstr code; prefer atomic_fetch_or_release() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_or_release(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_or_release) return arch_atomic_fetch_or_release(i, v); #elifdefined(arch_atomic_fetch_or_relaxed)
__atomic_release_fence(); return arch_atomic_fetch_or_relaxed(i, v); #elifdefined(arch_atomic_fetch_or) return arch_atomic_fetch_or(i, v); #else #error"Unable to define raw_atomic_fetch_or_release" #endif
}
/** * raw_atomic_fetch_or_relaxed() - atomic bitwise OR with relaxed ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v | @i) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_fetch_or_relaxed() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_or_relaxed(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_or_relaxed) return arch_atomic_fetch_or_relaxed(i, v); #elifdefined(arch_atomic_fetch_or) return arch_atomic_fetch_or(i, v); #else #error"Unable to define raw_atomic_fetch_or_relaxed" #endif
}
/** * raw_atomic_xor() - atomic bitwise XOR with relaxed ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v ^ @i) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_xor() elsewhere. * * Return: Nothing.
*/ static __always_inline void
raw_atomic_xor(int i, atomic_t *v)
{
arch_atomic_xor(i, v);
}
/** * raw_atomic_fetch_xor() - atomic bitwise XOR with full ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v ^ @i) with full ordering. * * Safe to use in noinstr code; prefer atomic_fetch_xor() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_xor(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_xor) return arch_atomic_fetch_xor(i, v); #elifdefined(arch_atomic_fetch_xor_relaxed) int ret;
__atomic_pre_full_fence();
ret = arch_atomic_fetch_xor_relaxed(i, v);
__atomic_post_full_fence(); return ret; #else #error"Unable to define raw_atomic_fetch_xor" #endif
}
/** * raw_atomic_fetch_xor_acquire() - atomic bitwise XOR with acquire ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v ^ @i) with acquire ordering. * * Safe to use in noinstr code; prefer atomic_fetch_xor_acquire() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_xor_acquire(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_xor_acquire) return arch_atomic_fetch_xor_acquire(i, v); #elifdefined(arch_atomic_fetch_xor_relaxed) int ret = arch_atomic_fetch_xor_relaxed(i, v);
__atomic_acquire_fence(); return ret; #elifdefined(arch_atomic_fetch_xor) return arch_atomic_fetch_xor(i, v); #else #error"Unable to define raw_atomic_fetch_xor_acquire" #endif
}
/** * raw_atomic_fetch_xor_release() - atomic bitwise XOR with release ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v ^ @i) with release ordering. * * Safe to use in noinstr code; prefer atomic_fetch_xor_release() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_xor_release(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_xor_release) return arch_atomic_fetch_xor_release(i, v); #elifdefined(arch_atomic_fetch_xor_relaxed)
__atomic_release_fence(); return arch_atomic_fetch_xor_relaxed(i, v); #elifdefined(arch_atomic_fetch_xor) return arch_atomic_fetch_xor(i, v); #else #error"Unable to define raw_atomic_fetch_xor_release" #endif
}
/** * raw_atomic_fetch_xor_relaxed() - atomic bitwise XOR with relaxed ordering * @i: int value * @v: pointer to atomic_t * * Atomically updates @v to (@v ^ @i) with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_fetch_xor_relaxed() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_fetch_xor_relaxed(int i, atomic_t *v)
{ #ifdefined(arch_atomic_fetch_xor_relaxed) return arch_atomic_fetch_xor_relaxed(i, v); #elifdefined(arch_atomic_fetch_xor) return arch_atomic_fetch_xor(i, v); #else #error"Unable to define raw_atomic_fetch_xor_relaxed" #endif
}
/** * raw_atomic_xchg() - atomic exchange with full ordering * @v: pointer to atomic_t * @new: int value to assign * * Atomically updates @v to @new with full ordering. * * Safe to use in noinstr code; prefer atomic_xchg() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_xchg(atomic_t *v, intnew)
{ #ifdefined(arch_atomic_xchg) return arch_atomic_xchg(v, new); #elifdefined(arch_atomic_xchg_relaxed) int ret;
__atomic_pre_full_fence();
ret = arch_atomic_xchg_relaxed(v, new);
__atomic_post_full_fence(); return ret; #else return raw_xchg(&v->counter, new); #endif
}
/** * raw_atomic_xchg_acquire() - atomic exchange with acquire ordering * @v: pointer to atomic_t * @new: int value to assign * * Atomically updates @v to @new with acquire ordering. * * Safe to use in noinstr code; prefer atomic_xchg_acquire() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_xchg_acquire(atomic_t *v, intnew)
{ #ifdefined(arch_atomic_xchg_acquire) return arch_atomic_xchg_acquire(v, new); #elifdefined(arch_atomic_xchg_relaxed) int ret = arch_atomic_xchg_relaxed(v, new);
__atomic_acquire_fence(); return ret; #elifdefined(arch_atomic_xchg) return arch_atomic_xchg(v, new); #else return raw_xchg_acquire(&v->counter, new); #endif
}
/** * raw_atomic_xchg_release() - atomic exchange with release ordering * @v: pointer to atomic_t * @new: int value to assign * * Atomically updates @v to @new with release ordering. * * Safe to use in noinstr code; prefer atomic_xchg_release() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_xchg_release(atomic_t *v, intnew)
{ #ifdefined(arch_atomic_xchg_release) return arch_atomic_xchg_release(v, new); #elifdefined(arch_atomic_xchg_relaxed)
__atomic_release_fence(); return arch_atomic_xchg_relaxed(v, new); #elifdefined(arch_atomic_xchg) return arch_atomic_xchg(v, new); #else return raw_xchg_release(&v->counter, new); #endif
}
/** * raw_atomic_xchg_relaxed() - atomic exchange with relaxed ordering * @v: pointer to atomic_t * @new: int value to assign * * Atomically updates @v to @new with relaxed ordering. * * Safe to use in noinstr code; prefer atomic_xchg_relaxed() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_xchg_relaxed(atomic_t *v, intnew)
{ #ifdefined(arch_atomic_xchg_relaxed) return arch_atomic_xchg_relaxed(v, new); #elifdefined(arch_atomic_xchg) return arch_atomic_xchg(v, new); #else return raw_xchg_relaxed(&v->counter, new); #endif
}
/** * raw_atomic_cmpxchg() - atomic compare and exchange with full ordering * @v: pointer to atomic_t * @old: int value to compare with * @new: int value to assign * * If (@v == @old), atomically updates @v to @new with full ordering. * Otherwise, @v is not modified and relaxed ordering is provided. * * Safe to use in noinstr code; prefer atomic_cmpxchg() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_cmpxchg(atomic_t *v, int old, intnew)
{ #ifdefined(arch_atomic_cmpxchg) return arch_atomic_cmpxchg(v, old, new); #elifdefined(arch_atomic_cmpxchg_relaxed) int ret;
__atomic_pre_full_fence();
ret = arch_atomic_cmpxchg_relaxed(v, old, new);
__atomic_post_full_fence(); return ret; #else return raw_cmpxchg(&v->counter, old, new); #endif
}
/** * raw_atomic_cmpxchg_acquire() - atomic compare and exchange with acquire ordering * @v: pointer to atomic_t * @old: int value to compare with * @new: int value to assign * * If (@v == @old), atomically updates @v to @new with acquire ordering. * Otherwise, @v is not modified and relaxed ordering is provided. * * Safe to use in noinstr code; prefer atomic_cmpxchg_acquire() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_cmpxchg_acquire(atomic_t *v, int old, intnew)
{ #ifdefined(arch_atomic_cmpxchg_acquire) return arch_atomic_cmpxchg_acquire(v, old, new); #elifdefined(arch_atomic_cmpxchg_relaxed) int ret = arch_atomic_cmpxchg_relaxed(v, old, new);
__atomic_acquire_fence(); return ret; #elifdefined(arch_atomic_cmpxchg) return arch_atomic_cmpxchg(v, old, new); #else return raw_cmpxchg_acquire(&v->counter, old, new); #endif
}
/** * raw_atomic_cmpxchg_release() - atomic compare and exchange with release ordering * @v: pointer to atomic_t * @old: int value to compare with * @new: int value to assign * * If (@v == @old), atomically updates @v to @new with release ordering. * Otherwise, @v is not modified and relaxed ordering is provided. * * Safe to use in noinstr code; prefer atomic_cmpxchg_release() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_cmpxchg_release(atomic_t *v, int old, intnew)
{ #ifdefined(arch_atomic_cmpxchg_release) return arch_atomic_cmpxchg_release(v, old, new); #elifdefined(arch_atomic_cmpxchg_relaxed)
__atomic_release_fence(); return arch_atomic_cmpxchg_relaxed(v, old, new); #elifdefined(arch_atomic_cmpxchg) return arch_atomic_cmpxchg(v, old, new); #else return raw_cmpxchg_release(&v->counter, old, new); #endif
}
/** * raw_atomic_cmpxchg_relaxed() - atomic compare and exchange with relaxed ordering * @v: pointer to atomic_t * @old: int value to compare with * @new: int value to assign * * If (@v == @old), atomically updates @v to @new with relaxed ordering. * Otherwise, @v is not modified and relaxed ordering is provided. * * Safe to use in noinstr code; prefer atomic_cmpxchg_relaxed() elsewhere. * * Return: The original value of @v.
*/ static __always_inline int
raw_atomic_cmpxchg_relaxed(atomic_t *v, int old, intnew)
{ #ifdefined(arch_atomic_cmpxchg_relaxed) return arch_atomic_cmpxchg_relaxed(v, old, new); #elifdefined(arch_atomic_cmpxchg) return arch_atomic_cmpxchg(v, old, new); #else return raw_cmpxchg_relaxed(&v->counter, old, new); #endif
}
/** * raw_atomic_try_cmpxchg() - atomic compare and exchange with full ordering * @v: pointer to atomic_t * @old: pointer to int value to compare with * @new: int value to assign * * If (@v == @old), atomically updates @v to @new with full ordering. * Otherwise, @v is not modified, @old is updated to the current value of @v, * and relaxed ordering is provided. * * Safe to use in noinstr code; prefer atomic_try_cmpxchg() elsewhere. * * Return: @true if the exchange occured, @false otherwise.
*/ static __always_inline bool
raw_atomic_try_cmpxchg(atomic_t *v, int *old, intnew)
{ #ifdefined(arch_atomic_try_cmpxchg) return arch_atomic_try_cmpxchg(v, old, new); #elifdefined(arch_atomic_try_cmpxchg_relaxed) bool ret;
__atomic_pre_full_fence();
ret = arch_atomic_try_cmpxchg_relaxed(v, old, new);
__atomic_post_full_fence(); return ret; #else int r, o = *old;
r = raw_atomic_cmpxchg(v, o, new); if (unlikely(r != o))
*old = r; return likely(r == o); #endif
}
/** * raw_atomic_try_cmpxchg_acquire() - atomic compare and exchange with acquire ordering * @v: pointer to atomic_t * @old: pointer to int value to compare with * @new: int value to assign * * If (@v == @old), atomically updates @v to @new with acquire ordering. * Otherwise, @v is not modified, @old is updated to the current value of @v, * and relaxed ordering is provided. * * Safe to use in noinstr code; prefer atomic_try_cmpxchg_acquire() elsewhere. * * Return: @true if the exchange occured, @false otherwise.
*/ static __always_inline bool
raw_atomic_try_cmpxchg_acquire(atomic_t *v, int *old, intnew)
{ #ifdefined(arch_atomic_try_cmpxchg_acquire) return arch_atomic_try_cmpxchg_acquire(v, old, new); #elifdefined(arch_atomic_try_cmpxchg_relaxed) bool ret = arch_atomic_try_cmpxchg_relaxed(v, old, new);
__atomic_acquire_fence(); return ret; #elifdefined(arch_atomic_try_cmpxchg) return arch_atomic_try_cmpxchg(v, old, new); #else int r, o = *old;
r = raw_atomic_cmpxchg_acquire(v, o, new); if (unlikely(r != o))
*old = r; return likely(r == o); #endif
}
/** * raw_atomic_try_cmpxchg_release() - atomic compare and exchange with release ordering * @v: pointer to atomic_t * @old: pointer to int value to compare with * @new: int value to assign * * If (@v == @old), atomically updates @v to @new with release ordering. * Otherwise, @v is not modified, @old is updated to the current value of @v, * and relaxed ordering is provided. * * Safe to use in noinstr code; prefer atomic_try_cmpxchg_release() elsewhere. * * Return: @true if the exchange occured, @false otherwise.
*/ static __always_inline bool
raw_atomic_try_cmpxchg_release(atomic_t *v, int *old, intnew)
{ #ifdefined(arch_atomic_try_cmpxchg_release) return arch_atomic_try_cmpxchg_release(v, old, new); #elifdefined(arch_atomic_try_cmpxchg_relaxed)
__atomic_release_fence(); return arch_atomic_try_cmpxchg_relaxed(v, old, new); #elifdefined(arch_atomic_try_cmpxchg) return arch_atomic_try_cmpxchg(v, old, new); #else int r, o = *old;
r = raw_atomic_cmpxchg_release(v, o, new); if (unlikely(r != o))
*old = r; return likely(r == o); #endif
}
/** * raw_atomic_try_cmpxchg_relaxed() - atomic compare and exchange with relaxed ordering * @v: pointer to atomic_t * @old: pointer to int value to compare with * @new: int value to assign * * If (@v == @old), atomically updates @v to @new with relaxed ordering. * Otherwise, @v is not modified, @old is updated to the current value of @v, * and relaxed ordering is provided. * * Safe to use in noinstr code; prefer atomic_try_cmpxchg_relaxed() elsewhere. * * Return: @true if the exchange occured, @false otherwise.
*/ static __always_inline bool
raw_atomic_try_cmpxchg_relaxed(atomic_t *v, int *old, intnew)
{ #ifdefined(arch_atomic_try_cmpxchg_relaxed) return arch_atomic_try_cmpxchg_relaxed(v, old, new); #elifdefined(arch_atomic_try_cmpxchg) return arch_atomic_try_cmpxchg(v, old, new); #else int r, o = *old;
r = raw_atomic_cmpxchg_relaxed(v, o, new); if (unlikely(r != o))
*old = r; return likely(r == o); #endif
}
/** * raw_atomic_sub_and_test() - atomic subtract and test if zero with full ordering * @i: int value to subtract * @v: pointer to atomic_t * * Atomically updates @v to (@v - @i) with full ordering. * * Safe to use in noinstr code; prefer atomic_sub_and_test() elsewhere. * * Return: @true if the resulting value of @v is zero, @false otherwise.
*/ static __always_inline bool
raw_atomic_sub_and_test(int i, atomic_t *v)
{ #ifdefined(arch_atomic_sub_and_test) return arch_atomic_sub_and_test(i, v); #else return raw_atomic_sub_return(i, v) == 0; #endif
}
/** * raw_atomic_dec_and_test() - atomic decrement and test if zero with full ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v - 1) with full ordering. * * Safe to use in noinstr code; prefer atomic_dec_and_test() elsewhere. * * Return: @true if the resulting value of @v is zero, @false otherwise.
*/ static __always_inline bool
raw_atomic_dec_and_test(atomic_t *v)
{ #ifdefined(arch_atomic_dec_and_test) return arch_atomic_dec_and_test(v); #else return raw_atomic_dec_return(v) == 0; #endif
}
/** * raw_atomic_inc_and_test() - atomic increment and test if zero with full ordering * @v: pointer to atomic_t * * Atomically updates @v to (@v + 1) with full ordering. * * Safe to use in noinstr code; prefer atomic_inc_and_test() elsewhere. * * Return: @true if the resulting value of @v is zero, @false otherwise.
*/ static __always_inline bool
raw_atomic_inc_and_test(atomic_t *v)
{ #ifdefined(arch_atomic_inc_and_test) return arch_atomic_inc_and_test(v); #else return raw_atomic_inc_return(v) == 0; #endif
}
/** * raw_atomic_add_negative() - atomic add and test if negative with full ordering * @i: int value to add * @v: pointer to atomic_t * * Atomically updates @v to (@v + @i) with full ordering. * * Safe to use in noinstr code; prefer atomic_add_negative() elsewhere. * * Return: @true if the resulting value of @v is negative, @false otherwise.
*/ static __always_inline bool
raw_atomic_add_negative(int i, atomic_t *v)
{ #ifdefined(arch_atomic_add_negative) return arch_atomic_add_negative(i, v); #elifdefined(arch_atomic_add_negative_relaxed) bool ret;
__atomic_pre_full_fence();
ret = arch_atomic_add_negative_relaxed(i, v);
__atomic_post_full_fence(); return ret; #else return raw_atomic_add_return(i, v) < 0; #endif
}
/** * raw_atomic_add_negative_acquire() - atomic add and test if negative with acquire ordering * @i: int value to add * @v: pointer to atomic_t * * Atomically updates @v to (@v + @i) with acquire ordering. * * Safe to use in noinstr code; prefer atomic_add_negative_acquire() elsewhere. * * Return: @true if the resulting value of @v is negative, @false otherwise.
*/ static __always_inline bool
raw_atomic_add_negative_acquire(int i, atomic_t *v)
{ #ifdefined(arch_atomic_add_negative_acquire) return arch_atomic_add_negative_acquire(i, v); #elifdefined(arch_atomic_add_negative_relaxed) bool ret = arch_atomic_add_negative_relaxed(i, v);
__atomic_acquire_fence(); return ret; #elifdefined(arch_atomic_add_negative) return arch_atomic_add_negative(i, v); #else return raw_atomic_add_return_acquire(i, v) < 0; #endif
}
/** * raw_atomic_add_negative_release() - atomic add and test if negative with release ordering * @i: int value to add * @v: pointer to atomic_t * * Atomically updates @v to (@v + @i) with release ordering. * * Safe to use in noinstr code; prefer atomic_add_negative_release() elsewhere. * * Return: @true if the resulting value of @v is negative, @false otherwise.
*/ static __always_inline bool
raw_atomic_add_negative_release(int i, atomic_t *v)
{ #ifdefined(arch_atomic_add_negative_release) return arch_atomic_add_negative_release(i, v); #elifdefined(arch_atomic_add_negative_relaxed)
__atomic_release_fence();
--> --------------------
--> maximum size reached
--> --------------------
Messung V0.5
¤ Dauer der Verarbeitung: 0.33 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.