qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH v4 1/2] qemu/atomic: Update coding style to make checkpatch.pl happier
Date: Wed, 23 Sep 2020 13:53:17 -0700	[thread overview]
Message-ID: <20200923205317.GA85735@Carlos-MBP> (raw)
In-Reply-To: <20200923182714.GA70694@stefanha-x1.localdomain>

will be also nice to squash the following on top for a complete clean
checkpatch version, as the original patch introduces at least 1 issue

Carlo
--- >8 ---
Subject: fixup! [PATCH 1/2] qemu/atomic.h: rename atomic_ to qatomic_

fixes:

ERROR: Macros with multiple statements should be enclosed in a do - while loop
+#define qatomic_rcu_read__nocheck(ptr, valptr)           \
+    __atomic_load(ptr, valptr, __ATOMIC_RELAXED);        \
     smp_read_barrier_depends();

false positive:

ERROR: memory barrier without comment
+#define qatomic_xchg(ptr, i)    (smp_mb(), __sync_lock_test_and_set(ptr, i))

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 include/qemu/atomic.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
index 87b85f9f6d..be47e083be 100644
--- a/include/qemu/atomic.h
+++ b/include/qemu/atomic.h
@@ -149,9 +149,10 @@
 #define qatomic_rcu_read__nocheck(ptr, valptr)           \
     __atomic_load(ptr, valptr, __ATOMIC_CONSUME);
 #else
-#define qatomic_rcu_read__nocheck(ptr, valptr)           \
+#define qatomic_rcu_read__nocheck(ptr, valptr) do {      \
     __atomic_load(ptr, valptr, __ATOMIC_RELAXED);        \
-    smp_read_barrier_depends();
+    smp_read_barrier_depends();                          \
+} while (0)
 #endif
 
 #define qatomic_rcu_read(ptr)                          \
-- 
2.28.0.681.g6f77f65b4e



  reply	other threads:[~2020-09-23 20:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 15:18 [PATCH v4 0/2] qemu/atomic.h: rename atomic_ to qatomic_ Philippe Mathieu-Daudé
2020-09-23 15:19 ` [PATCH v4 1/2] qemu/atomic: Update coding style to make checkpatch.pl happier Philippe Mathieu-Daudé
2020-09-23 18:27   ` Stefan Hajnoczi
2020-09-23 20:53     ` Carlo Marcelo Arenas Belón [this message]
2020-09-23 15:19 ` [PATCH v4 2/2] qemu/atomic.h: rename atomic_ to qatomic_ Philippe Mathieu-Daudé
2020-09-23 18:34 ` [PATCH v4 0/2] " no-reply
2020-09-23 22:29 ` no-reply

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=20200923205317.GA85735@Carlos-MBP \
    --to=carenas@gmail.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).