]> git.proxmox.com Git - mirror_qemu.git/commitdiff
atomic.h: Reword confusing comment for qatomic_cmpxchg
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 23 Feb 2024 18:20:35 +0000 (18:20 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 5 Mar 2024 13:22:56 +0000 (13:22 +0000)
The qatomic_cmpxchg() and qatomic_cmpxchg__nocheck() macros have
a comment that reads:
 Returns the eventual value, failed or not

This is somewhere between cryptic and wrong, since the value actually
returned is the value that was in memory before the cmpxchg.  Reword
to match how we describe these macros in atomics.rst.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-id: 20240223182035.1048541-1-peter.maydell@linaro.org

include/qemu/atomic.h

index f1d3d1702a93c20b83eac503fa74a77b3895cbef..99110abefb3d14393eb10f2b9efd7f478f9419b7 100644 (file)
     qatomic_xchg__nocheck(ptr, i);                          \
 })
 
-/* Returns the eventual value, failed or not */
+/* Returns the old value of '*ptr' (whether the cmpxchg failed or not) */
 #define qatomic_cmpxchg__nocheck(ptr, old, new)    ({                   \
     typeof_strip_qual(*ptr) _old = (old);                               \
     (void)__atomic_compare_exchange_n(ptr, &_old, new, false,           \