QEMU-Trivial Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Evgeny Kolmakov <randomjack94dev@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, stefanha@redhat.com, fam@euphon.net,
	kwolf@redhat.com, hreitz@redhat.com, zhangckid@gmail.com,
	lizhijian@fujitsu.com, jasowang@redhat.com,
	Evgeny Kolmakov <randomjack94dev@gmail.com>
Subject: [PATCH 1/2] net/colo-compare: Use QEMU_LOCK_GUARD to simplify mutex handling
Date: Fri, 22 May 2026 11:06:43 +0300	[thread overview]
Message-ID: <20260522080644.9531-2-randomjack94dev@gmail.com> (raw)
In-Reply-To: <20260522080644.9531-1-randomjack94dev@gmail.com>

Replace qemu_mutex_(un)lock() calls with the QEMU_LOCK_GUARD().

Signed-off-by: Evgeny Kolmakov <randomjack94dev@gmail.com>
---
 net/colo-compare.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/net/colo-compare.c b/net/colo-compare.c
index 823b8aa323..5986fb1e88 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -902,14 +902,13 @@ static void check_old_packet_regular(void *opaque)
 void colo_notify_compares_event(void *opaque, int event, Error **errp)
 {
     CompareState *s;
-    qemu_mutex_lock(&colo_compare_mutex);
+    QEMU_LOCK_GUARD(&colo_compare_mutex);
 
     if (!colo_compare_active) {
-        qemu_mutex_unlock(&colo_compare_mutex);
         return;
     }
 
-    qemu_mutex_lock(&event_mtx);
+    QEMU_LOCK_GUARD(&event_mtx);
     QTAILQ_FOREACH(s, &net_compares, next) {
         s->event = event;
         qemu_bh_schedule(s->event_bh);
@@ -919,9 +918,6 @@ void colo_notify_compares_event(void *opaque, int event, Error **errp)
     while (event_unhandled_count > 0) {
         qemu_cond_wait(&event_complete_cond, &event_mtx);
     }
-
-    qemu_mutex_unlock(&event_mtx);
-    qemu_mutex_unlock(&colo_compare_mutex);
 }
 
 static void colo_compare_timer_init(CompareState *s)
-- 
2.43.0



  reply	other threads:[~2026-05-22 12:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22  8:06 [PATCH 0/2] Mechanical conversion to QEMU_LOCK_GUARD Evgeny Kolmakov
2026-05-22  8:06 ` Evgeny Kolmakov [this message]
2026-05-26  7:46   ` [PATCH 1/2] net/colo-compare: Use QEMU_LOCK_GUARD to simplify mutex handling Philippe Mathieu-Daudé
2026-05-22  8:06 ` [PATCH 2/2] block/io: " Evgeny Kolmakov
2026-05-26  7:46   ` Philippe Mathieu-Daudé
2026-05-25 11:45 ` [PATCH 0/2] Mechanical conversion to QEMU_LOCK_GUARD Zhang Chen

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=20260522080644.9531-2-randomjack94dev@gmail.com \
    --to=randomjack94dev@gmail.com \
    --cc=fam@euphon.net \
    --cc=hreitz@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lizhijian@fujitsu.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=zhangckid@gmail.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