blob: ed8a1f5626675297ef9735b501a3321a0dad350f [file] [log] [blame]
Mark Rutlandace9bad2018-09-04 11:48:25 +01001cat <<EOF
2/**
Mark Rutlandf3e615b2021-07-13 11:52:50 +01003 * arch_${atomic}_inc_not_zero - increment unless the number is zero
Mark Rutlandace9bad2018-09-04 11:48:25 +01004 * @v: pointer of type ${atomic}_t
5 *
6 * Atomically increments @v by 1, if @v is non-zero.
7 * Returns true if the increment was done.
8 */
Marco Elver765dcd22019-11-26 15:04:05 +01009static __always_inline bool
Mark Rutlandf3e615b2021-07-13 11:52:50 +010010arch_${atomic}_inc_not_zero(${atomic}_t *v)
Mark Rutlandace9bad2018-09-04 11:48:25 +010011{
Mark Rutlandf3e615b2021-07-13 11:52:50 +010012 return arch_${atomic}_add_unless(v, 1, 0);
Mark Rutlandace9bad2018-09-04 11:48:25 +010013}
14EOF