From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: Peter Maydell <peter.maydell@linaro.org>, <qemu-devel@nongnu.org>
Subject: Re: [PATCH] atomic.h: Reword confusing comment for qatomic_cmpxchg
Date: Fri, 23 Feb 2024 18:23:34 +0000 [thread overview]
Message-ID: <20240223182334.000014ca@Huawei.com> (raw)
In-Reply-To: <808e13f8-11da-4ec1-969d-d2495cbd3a88@linaro.org>
On Fri, 23 Feb 2024 08:21:42 -1000
Richard Henderson <richard.henderson@linaro.org> wrote:
> On 2/23/24 08:20, Peter Maydell wrote:
> > 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>
> > ---
> > include/qemu/atomic.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
> > index f1d3d1702a9..99110abefb3 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, \
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
As the person it confused ;)
>
> r~
next prev parent reply other threads:[~2024-02-23 18:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-23 18:20 [PATCH] atomic.h: Reword confusing comment for qatomic_cmpxchg Peter Maydell
2024-02-23 18:21 ` Richard Henderson
2024-02-23 18:23 ` Jonathan Cameron via [this message]
2024-02-26 8:46 ` Zhao Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240223182334.000014ca@Huawei.com \
--to=qemu-devel@nongnu.org \
--cc=Jonathan.Cameron@Huawei.com \
--cc=peter.maydell@linaro.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.