[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/9] char: Replaced a qemu_mutex_lock with QEMU_LOCK_GUARD
From: |
Mahmoud Mandour |
Subject: |
[PATCH 3/9] char: Replaced a qemu_mutex_lock with QEMU_LOCK_GUARD |
Date: |
Thu, 11 Mar 2021 05:15:32 +0200 |
Removed a pair of qemu_mutex_lock and its respective qemu_mutex_unlock
and used a QEMU_LOCK_GUARD instead. This improves readability by
removing the call to qemu_mutex_unlock.
Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
---
chardev/char.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/chardev/char.c b/chardev/char.c
index 97cafd6849..2b0bc1325c 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -115,7 +115,7 @@ static int qemu_chr_write_buffer(Chardev *s,
int res = 0;
*offset = 0;
- qemu_mutex_lock(&s->chr_write_lock);
+ QEMU_LOCK_GUARD(&s->chr_write_lock);
while (*offset < len) {
retry:
res = cc->chr_write(s, buf + *offset, len - *offset);
@@ -153,7 +153,6 @@ static int qemu_chr_write_buffer(Chardev *s,
*/
qemu_chr_write_log(s, buf, len);
}
- qemu_mutex_unlock(&s->chr_write_lock);
return res;
}
--
2.25.1
- [PATCH 0/9] Changing qemu_mutex_locks to lock guard macros, Mahmoud Mandour, 2021/03/11
- [PATCH 3/9] char: Replaced a qemu_mutex_lock with QEMU_LOCK_GUARD,
Mahmoud Mandour <=
- [PATCH 5/9] monitor: Replaced qemu_mutex_lock calls with QEMU_LOCK_GUARD, Mahmoud Mandour, 2021/03/11
- [PATCH 4/9] util: Replaced qemu_mutex_lock with QEMU_LOCK_GUARDs, Mahmoud Mandour, 2021/03/11
- [PATCH 7/9] virtio-iommu: Replaced qemu_mutex_lock calls with QEMU_LOCK_GUARD, Mahmoud Mandour, 2021/03/11
- [PATCH 8/9] hw/9pfs/9p-synth: Replaced qemu_mutex_lock with QEMU_LOCK_GUARD, Mahmoud Mandour, 2021/03/11