aboutsummaryrefslogtreecommitdiff
path: root/util/vfio-helpers.c
diff options
context:
space:
mode:
authorDaniel Brodsky <dnbrdsky@gmail.com>2020-04-03 21:21:08 -0700
committerStefan Hajnoczi <stefanha@redhat.com>2020-05-04 16:07:43 +0100
commit6e8a355de6c4d32e9df336cdafb009cd78262836 (patch)
treedc839bbdbdfab8c588445a8b9d9283e0dda18d39 /util/vfio-helpers.c
parent56f21718b8767a1b523f2a14107d6307336ca51d (diff)
downloadqemu-6e8a355de6c4d32e9df336cdafb009cd78262836.zip
qemu-6e8a355de6c4d32e9df336cdafb009cd78262836.tar.gz
qemu-6e8a355de6c4d32e9df336cdafb009cd78262836.tar.bz2
lockable: replaced locks with lock guard macros where appropriate
- ran regexp "qemu_mutex_lock\(.*\).*\n.*if" to find targets - replaced result with QEMU_LOCK_GUARD if all unlocks at function end - replaced result with WITH_QEMU_LOCK_GUARD if unlock not at end Signed-off-by: Daniel Brodsky <dnbrdsky@gmail.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-id: 20200404042108.389635-3-dnbrdsky@gmail.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'util/vfio-helpers.c')
-rw-r--r--util/vfio-helpers.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
index ddd9a96..e399e33 100644
--- a/util/vfio-helpers.c
+++ b/util/vfio-helpers.c
@@ -21,6 +21,7 @@
#include "standard-headers/linux/pci_regs.h"
#include "qemu/event_notifier.h"
#include "qemu/vfio-helpers.h"
+#include "qemu/lockable.h"
#include "trace.h"
#define QEMU_VFIO_DEBUG 0
@@ -667,14 +668,12 @@ int qemu_vfio_dma_reset_temporary(QEMUVFIOState *s)
.size = QEMU_VFIO_IOVA_MAX - s->high_water_mark,
};
trace_qemu_vfio_dma_reset_temporary(s);
- qemu_mutex_lock(&s->lock);
+ QEMU_LOCK_GUARD(&s->lock);
if (ioctl(s->container, VFIO_IOMMU_UNMAP_DMA, &unmap)) {
error_report("VFIO_UNMAP_DMA failed: %s", strerror(errno));
- qemu_mutex_unlock(&s->lock);
return -errno;
}
s->high_water_mark = QEMU_VFIO_IOVA_MAX;
- qemu_mutex_unlock(&s->lock);
return 0;
}