xref: /linux/scripts/atomic/fallbacks/add_unless (revision 8795a739e5c72abeec51caf36b6df2b37e5720c5)
1cat << EOF
2/**
3 * ${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 inline bool
12${atomic}_add_unless(${atomic}_t *v, ${int} a, ${int} u)
13{
14	return ${atomic}_fetch_add_unless(v, a, u) != u;
15}
16EOF
17