From: Peter Maydell Date: Fri, 23 Feb 2024 18:20:35 +0000 (+0000) Subject: atomic.h: Reword confusing comment for qatomic_cmpxchg X-Git-Tag: v9.0.0~79^2~1 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=d346feed696c536f178f8110666e2bcc4c21b983;p=mirror_qemu.git atomic.h: Reword confusing comment for qatomic_cmpxchg 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 Reviewed-by: Richard Henderson Reviewed-by: Jonathan Cameron Reviewed-by: Zhao Liu Message-id: 20240223182035.1048541-1-peter.maydell@linaro.org --- diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h index f1d3d1702a..99110abefb 100644 --- a/include/qemu/atomic.h +++ b/include/qemu/atomic.h @@ -202,7 +202,7 @@ 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, \