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}_add_negative - add and test if negative |
Mark Rutland | ace9bad | 2018-09-04 11:48:25 +0100 | [diff] [blame] | 4 | * @i: integer value to add |
| 5 | * @v: pointer of type ${atomic}_t |
| 6 | * |
| 7 | * Atomically adds @i to @v and returns true |
| 8 | * if the result is negative, or false when |
| 9 | * result is greater than or equal to zero. |
| 10 | */ |
Marco Elver | 765dcd2 | 2019-11-26 15:04:05 +0100 | [diff] [blame] | 11 | static __always_inline bool |
Mark Rutland | f3e615b | 2021-07-13 11:52:50 +0100 | [diff] [blame] | 12 | arch_${atomic}_add_negative(${int} i, ${atomic}_t *v) |
Mark Rutland | ace9bad | 2018-09-04 11:48:25 +0100 | [diff] [blame] | 13 | { |
Mark Rutland | f3e615b | 2021-07-13 11:52:50 +0100 | [diff] [blame] | 14 | return arch_${atomic}_add_return(i, v) < 0; |
Mark Rutland | ace9bad | 2018-09-04 11:48:25 +0100 | [diff] [blame] | 15 | } |
| 16 | EOF |