add_unless (4b4193256c8d3bc3a5397b5cd9494c2ad386317d) add_unless (f3e615b4db1fb7034f1d76dc307b77cc848f040e)
1cat << EOF
2/**
1cat << EOF
2/**
3 * ${arch}${atomic}_add_unless - add unless the number is already a given value
3 * arch_${atomic}_add_unless - add unless the number is already a given value
4 * @v: pointer of type ${atomic}_t
5 * @a: the amount to add to v...
6 * @u: ...unless v is equal to u.
7 *
8 * Atomically adds @a to @v, if @v was not already @u.
9 * Returns true if the addition was done.
10 */
11static __always_inline bool
4 * @v: pointer of type ${atomic}_t
5 * @a: the amount to add to v...
6 * @u: ...unless v is equal to u.
7 *
8 * Atomically adds @a to @v, if @v was not already @u.
9 * Returns true if the addition was done.
10 */
11static __always_inline bool
12${arch}${atomic}_add_unless(${atomic}_t *v, ${int} a, ${int} u)
12arch_${atomic}_add_unless(${atomic}_t *v, ${int} a, ${int} u)
13{
13{
14 return ${arch}${atomic}_fetch_add_unless(v, a, u) != u;
14 return arch_${atomic}_fetch_add_unless(v, a, u) != u;
15}
16EOF
15}
16EOF