diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2019-07-11 09:24:10 +0300 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2019-07-11 09:24:10 +0300 |
commit | 597473720f4dc69749542bfcfed4a927a43d935e (patch) | |
tree | 711bf773910fb93d1dd9120c633adc807685e0d8 /scripts/atomic/fallbacks/inc_not_zero | |
parent | f0dd687815f9546860fc3ac4379d55da045942c9 (diff) | |
parent | 593fdd4fb44ef2cbf4ec53ec2c6eb60eb079bb4c (diff) | |
download | linux-597473720f4dc69749542bfcfed4a927a43d935e.tar.xz |
Merge branch 'next' into for-linus
Prepare input updates for 5.3 merge window.
Diffstat (limited to 'scripts/atomic/fallbacks/inc_not_zero')
-rwxr-xr-x | scripts/atomic/fallbacks/inc_not_zero | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/atomic/fallbacks/inc_not_zero b/scripts/atomic/fallbacks/inc_not_zero new file mode 100755 index 000000000000..a7c45c8d107c --- /dev/null +++ b/scripts/atomic/fallbacks/inc_not_zero @@ -0,0 +1,14 @@ +cat <<EOF +/** + * ${atomic}_inc_not_zero - increment unless the number is zero + * @v: pointer of type ${atomic}_t + * + * Atomically increments @v by 1, if @v is non-zero. + * Returns true if the increment was done. + */ +static inline bool +${atomic}_inc_not_zero(${atomic}_t *v) +{ + return ${atomic}_add_unless(v, 1, 0); +} +EOF |