summaryrefslogtreecommitdiff
path: root/include/linux/atomic/atomic-arch-fallback.h
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2023-06-15 14:27:34 +0100
committerPeter Zijlstra <peterz@infradead.org>2023-06-16 16:46:30 +0200
commitb33eb50a92b0a298fa8a6ac350e741c3ec100f6d (patch)
tree3026dae3d961623a895130facdb0ec47ea5e5254 /include/linux/atomic/atomic-arch-fallback.h
parent093d9b240a1fa261ff8aeb7c7cc484dedacfda53 (diff)
locking/atomic: scripts: fix ${atomic}_dec_if_positive() kerneldoc
The ${atomic}_dec_if_positive() ops are unlike all the other conditional atomic ops. Rather than returning a boolean success value, these return the value that the atomic variable would be updated to, even when no update is performed. We missed this when adding kerneldoc comments, and the documentation for ${atomic}_dec_if_positive() erroneously states: | Return: @true if @v was updated, @false otherwise. Ideally we'd clean this up by aligning ${atomic}_dec_if_positive() with the usual atomic op conventions: with ${atomic}_fetch_dec_if_positive() for those who care about the value of the varaible, and ${atomic}_dec_if_positive() returning a boolean success value. In the mean time, align the documentation with the current reality. Fixes: ad8110706f381170 ("locking/atomic: scripts: generate kerneldoc comments") Signed-off-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Paul E. McKenney <paulmck@kernel.org> Link: https://lore.kernel.org/r/20230615132734.1119765-1-mark.rutland@arm.com
Diffstat (limited to 'include/linux/atomic/atomic-arch-fallback.h')
-rw-r--r--include/linux/atomic/atomic-arch-fallback.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/atomic/atomic-arch-fallback.h b/include/linux/atomic/atomic-arch-fallback.h
index 8cded57dd7a6..18f5744dfb5d 100644
--- a/include/linux/atomic/atomic-arch-fallback.h
+++ b/include/linux/atomic/atomic-arch-fallback.h
@@ -2520,7 +2520,7 @@ raw_atomic_dec_unless_positive(atomic_t *v)
*
* Safe to use in noinstr code; prefer atomic_dec_if_positive() elsewhere.
*
- * Return: @true if @v was updated, @false otherwise.
+ * Return: The old value of (@v - 1), regardless of whether @v was updated.
*/
static __always_inline int
raw_atomic_dec_if_positive(atomic_t *v)
@@ -4636,7 +4636,7 @@ raw_atomic64_dec_unless_positive(atomic64_t *v)
*
* Safe to use in noinstr code; prefer atomic64_dec_if_positive() elsewhere.
*
- * Return: @true if @v was updated, @false otherwise.
+ * Return: The old value of (@v - 1), regardless of whether @v was updated.
*/
static __always_inline s64
raw_atomic64_dec_if_positive(atomic64_t *v)
@@ -4657,4 +4657,4 @@ raw_atomic64_dec_if_positive(atomic64_t *v)
}
#endif /* _LINUX_ATOMIC_FALLBACK_H */
-// 3916f02c038baa3f5190d275f68b9211667fcc9d
+// 202b45c7db600ce36198eb1f1fc2c2d5268ace2d