[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 31/32] hw/vfio: Use lock guard macros
From: |
Alex Williamson |
Subject: |
[PULL v2 31/32] hw/vfio: Use lock guard macros |
Date: |
Wed, 28 Oct 2020 10:44:06 -0600 |
User-agent: |
StGit/0.21-dirty |
From: Amey Narkhede <ameynarkhede03@gmail.com>
Use qemu LOCK_GUARD macros in hw/vfio.
Saves manual unlock calls
Signed-off-by: Amey Narkhede <ameynarkhede03@gmail.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
hw/vfio/platform.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c
index 869ed2c39dcd..cc3f66f7e44c 100644
--- a/hw/vfio/platform.c
+++ b/hw/vfio/platform.c
@@ -166,7 +166,7 @@ static void vfio_intp_mmap_enable(void *opaque)
VFIOINTp *tmp;
VFIOPlatformDevice *vdev = (VFIOPlatformDevice *)opaque;
- qemu_mutex_lock(&vdev->intp_mutex);
+ QEMU_LOCK_GUARD(&vdev->intp_mutex);
QLIST_FOREACH(tmp, &vdev->intp_list, next) {
if (tmp->state == VFIO_IRQ_ACTIVE) {
trace_vfio_platform_intp_mmap_enable(tmp->pin);
@@ -174,12 +174,10 @@ static void vfio_intp_mmap_enable(void *opaque)
timer_mod(vdev->mmap_timer,
qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) +
vdev->mmap_timeout);
- qemu_mutex_unlock(&vdev->intp_mutex);
return;
}
}
vfio_mmap_set_enabled(vdev, true);
- qemu_mutex_unlock(&vdev->intp_mutex);
}
/**
@@ -289,7 +287,7 @@ static void vfio_platform_eoi(VFIODevice *vbasedev)
VFIOPlatformDevice *vdev =
container_of(vbasedev, VFIOPlatformDevice, vbasedev);
- qemu_mutex_lock(&vdev->intp_mutex);
+ QEMU_LOCK_GUARD(&vdev->intp_mutex);
QLIST_FOREACH(intp, &vdev->intp_list, next) {
if (intp->state == VFIO_IRQ_ACTIVE) {
trace_vfio_platform_eoi(intp->pin,
@@ -314,7 +312,6 @@ static void vfio_platform_eoi(VFIODevice *vbasedev)
vfio_intp_inject_pending_lockheld(intp);
QSIMPLEQ_REMOVE_HEAD(&vdev->pending_intp_queue, pqnext);
}
- qemu_mutex_unlock(&vdev->intp_mutex);
}
/**
- [PULL v2 21/32] vfio: Create shared routine for scanning info capabilities, (continued)
- [PULL v2 21/32] vfio: Create shared routine for scanning info capabilities, Alex Williamson, 2020/10/28
- [PULL v2 22/32] vfio: Find DMA available capability, Alex Williamson, 2020/10/28
- [PULL v2 23/32] s390x/pci: Add routine to get the vfio dma available count, Alex Williamson, 2020/10/28
- [PULL v2 24/32] s390x/pci: Honor DMA limits set by vfio, Alex Williamson, 2020/10/28
- [PULL v2 25/32] s390x/pci: create a header dedicated to PCI CLP, Alex Williamson, 2020/10/28
- [PULL v2 26/32] s390x/pci: use a PCI Group structure, Alex Williamson, 2020/10/28
- [PULL v2 27/32] s390x/pci: clean up s390 PCI groups, Alex Williamson, 2020/10/28
- [PULL v2 28/32] s390x/pci: use a PCI Function structure, Alex Williamson, 2020/10/28
- [PULL v2 29/32] vfio: Add routine for finding VFIO_DEVICE_GET_INFO capabilities, Alex Williamson, 2020/10/28
- [PULL v2 30/32] s390x/pci: get zPCI function info from host, Alex Williamson, 2020/10/28
- [PULL v2 31/32] hw/vfio: Use lock guard macros,
Alex Williamson <=
- [PULL v2 32/32] vfio: fix incorrect print type, Alex Williamson, 2020/10/28
- Re: [PULL v2 00/32] VFIO updates 2020-10-28 (for QEMU 5.2 soft-freeze), Peter Maydell, 2020/10/31