Mark Rutland | ace9bad | 2018-09-04 11:48:25 +0100 | [diff] [blame] | 1 | cat <<EOF |
| 2 | /** |
Mark Rutland | f3e615b | 2021-07-13 11:52:50 +0100 | [diff] [blame] | 3 | * arch_${atomic}_dec_and_test - decrement and test |
Mark Rutland | ace9bad | 2018-09-04 11:48:25 +0100 | [diff] [blame] | 4 | * @v: pointer of type ${atomic}_t |
| 5 | * |
| 6 | * Atomically decrements @v by 1 and |
| 7 | * returns true if the result is 0, or false for all other |
| 8 | * cases. |
| 9 | */ |
Marco Elver | 765dcd2 | 2019-11-26 15:04:05 +0100 | [diff] [blame] | 10 | static __always_inline bool |
Mark Rutland | f3e615b | 2021-07-13 11:52:50 +0100 | [diff] [blame] | 11 | arch_${atomic}_dec_and_test(${atomic}_t *v) |
Mark Rutland | ace9bad | 2018-09-04 11:48:25 +0100 | [diff] [blame] | 12 | { |
Mark Rutland | f3e615b | 2021-07-13 11:52:50 +0100 | [diff] [blame] | 13 | return arch_${atomic}_dec_return(v) == 0; |
Mark Rutland | ace9bad | 2018-09-04 11:48:25 +0100 | [diff] [blame] | 14 | } |
| 15 | EOF |