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

[libvirt] [PATCHv2 01/12] pci: eliminate unused driver arg from virPCIDeviceDetach



The driver arg to virPCIDeviceDetach is no longer used (the name of the stub driver is now set in the virPCIDevice object, and virPCIDeviceDetach retrieves it from there). Remove it.
---
 src/qemu/qemu_driver.c  |  2 +-
 src/qemu/qemu_hostdev.c |  2 +-
 src/util/virpci.c       | 13 +++++--------
 src/util/virpci.h       |  3 +--
 src/xen/xen_driver.c    |  2 +-
 5 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index efee62f..83770e5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10617,7 +10617,7 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
     virObjectLock(driver->inactivePciHostdevs);
 
     if (virPCIDeviceDetach(pci, driver->activePciHostdevs,
-                           driver->inactivePciHostdevs, NULL) < 0) {
+                           driver->inactivePciHostdevs) < 0) {
         goto out;
     }
 
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 7a9e6eb..dfe39c6 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -540,7 +540,7 @@ int qemuPrepareHostdevPCIDevices(virQEMUDriverPtr driver,
     for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
         virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);
         if (virPCIDeviceGetManaged(dev) &&
-            virPCIDeviceDetach(dev, driver->activePciHostdevs, NULL, NULL) < 0)
+            virPCIDeviceDetach(dev, driver->activePciHostdevs, NULL) < 0)
             goto reattachdevs;
     }
 
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 2f4032f..2980e22 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1238,15 +1238,12 @@ cleanup:
 int
 virPCIDeviceDetach(virPCIDevicePtr dev,
                    virPCIDeviceList *activeDevs,
-                   virPCIDeviceList *inactiveDevs,
-                   const char *driver)
+                   virPCIDeviceList *inactiveDevs)
 {
-    if (!driver && dev->stubDriver)
-        driver = dev->stubDriver;
-
-    if (virPCIProbeStubDriver(driver) < 0) {
+    if (virPCIProbeStubDriver(dev->stubDriver) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Failed to load PCI stub module %s"), driver);
+                       _("Failed to load PCI stub module %s"),
+                       dev->stubDriver);
         return -1;
     }
 
@@ -1256,7 +1253,7 @@ virPCIDeviceDetach(virPCIDevicePtr dev,
         return -1;
     }
 
-    if (virPCIDeviceBindToStub(dev, driver) < 0)
+    if (virPCIDeviceBindToStub(dev, dev->stubDriver) < 0)
         return -1;
 
     /* Add *a copy of* the dev into list inactiveDevs, if
diff --git a/src/util/virpci.h b/src/util/virpci.h
index d069adb..944aa09 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -51,8 +51,7 @@ const char *virPCIDeviceGetName(virPCIDevicePtr dev);
 
 int virPCIDeviceDetach(virPCIDevicePtr dev,
                        virPCIDeviceListPtr activeDevs,
-                       virPCIDeviceListPtr inactiveDevs,
-                       const char *driver);
+                       virPCIDeviceListPtr inactiveDevs);
 int virPCIDeviceReattach(virPCIDevicePtr dev,
                          virPCIDeviceListPtr activeDevs,
                          virPCIDeviceListPtr inactiveDevs);
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index ffc6e41..998fc69 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -2440,7 +2440,7 @@ xenUnifiedNodeDeviceDetachFlags(virNodeDevicePtr dev,
         goto out;
     }
 
-    if (virPCIDeviceDetach(pci, NULL, NULL, NULL) < 0)
+    if (virPCIDeviceDetach(pci, NULL, NULL) < 0)
         goto out;
 
     ret = 0;
-- 
1.7.11.7


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