Mark Rutland | ace9bad | 2018-09-04 11:48:25 +0100 | [diff] [blame] | 1 | cat <<EOF |
| 2 | /** |
Peter Zijlstra | 37f8173 | 2020-01-24 22:13:03 +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 |
Peter Zijlstra | 37f8173 | 2020-01-24 22:13:03 +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 | { |
Peter Zijlstra | 37f8173 | 2020-01-24 22:13:03 +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 |