ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 1) cat << EOF
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 2) /**
f3e615b4db1fb (Mark Rutland 2021-07-13 11:52:50 +0100 3) * arch_${atomic}_add_unless - add unless the number is already a given value
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 4) * @v: pointer of type ${atomic}_t
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 5) * @a: the amount to add to v...
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 6) * @u: ...unless v is equal to u.
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 7) *
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 8) * Atomically adds @a to @v, if @v was not already @u.
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 9) * Returns true if the addition was done.
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 10) */
765dcd209947e (Marco Elver 2019-11-26 15:04:05 +0100 11) static __always_inline bool
f3e615b4db1fb (Mark Rutland 2021-07-13 11:52:50 +0100 12) arch_${atomic}_add_unless(${atomic}_t *v, ${int} a, ${int} u)
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 13) {
f3e615b4db1fb (Mark Rutland 2021-07-13 11:52:50 +0100 14) return arch_${atomic}_fetch_add_unless(v, a, u) != u;
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 15) }
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 16) EOF