[PATCH v14 39/49] extract general code of NodeDeviceReset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx>
---
 src/qemu/qemu_driver.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3abcf5a..6b6a170 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11453,6 +11453,25 @@ cleanup:
 }
 
 static int
+virHostdevPciNodeDeviceReset(virHostdevManagerPtr hostdev_mgr,
+                             virPCIDevicePtr pci)
+{
+    int ret = -1;
+
+    virObjectLock(hostdev_mgr->activePciHostdevs);
+    virObjectLock(hostdev_mgr->inactivePciHostdevs);
+    if (virPCIDeviceReset(pci, hostdev_mgr->activePciHostdevs,
+                          hostdev_mgr->inactivePciHostdevs) < 0)
+        goto out;
+
+    ret = 0;
+out:
+    virObjectUnlock(hostdev_mgr->inactivePciHostdevs);
+    virObjectUnlock(hostdev_mgr->activePciHostdevs);
+    return ret;
+}
+
+static int
 qemuNodeDeviceReset(virNodeDevicePtr dev)
 {
     virQEMUDriverPtr driver = dev->conn->privateData;
@@ -11481,16 +11500,8 @@ qemuNodeDeviceReset(virNodeDevicePtr dev)
     if (!pci)
         goto cleanup;
 
-    virObjectLock(hostdev_mgr->activePciHostdevs);
-    virObjectLock(hostdev_mgr->inactivePciHostdevs);
-    if (virPCIDeviceReset(pci, hostdev_mgr->activePciHostdevs,
-                          hostdev_mgr->inactivePciHostdevs) < 0)
-        goto out;
+    ret = virHostdevPciNodeDeviceReset(hostdev_mgr, pci);
 
-    ret = 0;
-out:
-    virObjectUnlock(hostdev_mgr->inactivePciHostdevs);
-    virObjectUnlock(hostdev_mgr->activePciHostdevs);
     virPCIDeviceFree(pci);
 cleanup:
     virNodeDeviceDefFree(def);
-- 
1.9.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]