]> xenbits.xensource.com Git - libvirt.git/commitdiff
pci: Remove 'reprobe' parameter from virPCIDeviceUnbind()
authorAndrea Bolognani <abologna@redhat.com>
Thu, 29 Oct 2015 15:09:54 +0000 (16:09 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 21 Dec 2015 10:04:37 +0000 (11:04 +0100)
The value is not inspected inside the function, so it makes more
sense for the caller to change the device's setting explicitly.

src/util/virpci.c
src/util/virpci.h
tests/virpcitest.c

index 424983d96fac930c711e57f6f5b5f5adfa6e67f7..21eacf55039004b89fc9d4923c9f9b6de7ae2347 100644 (file)
@@ -1037,7 +1037,7 @@ virPCIProbeStubDriver(const char *driver)
 }
 
 int
-virPCIDeviceUnbind(virPCIDevicePtr dev, bool reprobe)
+virPCIDeviceUnbind(virPCIDevicePtr dev)
 {
     char *path = NULL;
     char *drvpath = NULL;
@@ -1063,7 +1063,6 @@ virPCIDeviceUnbind(virPCIDevicePtr dev, bool reprobe)
                                  dev->name, driver);
             goto cleanup;
         }
-        dev->reprobe = reprobe;
     }
 
     ret = 0;
@@ -1116,7 +1115,7 @@ virPCIDeviceUnbindFromStub(virPCIDevicePtr dev)
     if (!isStub)
         goto remove_slot;
 
-    if (virPCIDeviceUnbind(dev, dev->reprobe) < 0)
+    if (virPCIDeviceUnbind(dev) < 0)
         goto cleanup;
     dev->unbind_from_stub = false;
 
@@ -1230,9 +1229,12 @@ virPCIDeviceBindToStub(virPCIDevicePtr dev)
         goto remove_id;
     }
 
-    if (virPCIDeviceUnbind(dev, reprobe) < 0)
+    if (virPCIDeviceUnbind(dev) < 0)
         goto remove_id;
 
+    /* If the device was bound to a driver we'll need to reprobe later */
+    dev->reprobe = reprobe;
+
     /* If the device isn't already bound to pci-stub, try binding it now.
      */
     if (!virFileLinkPointsTo(driverLink, stubDriverPath)) {
index f3d567676611224c8ca68ac0934ac8c51e7a5dc8..e628ab896eedbdd2e079eb09939f1dac9b6f7a1a 100644 (file)
@@ -201,7 +201,7 @@ int virPCIDeviceAddressParse(char *address, virPCIDeviceAddressPtr bdf);
 int virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
                                  char **pfname, int *vf_index);
 
-int virPCIDeviceUnbind(virPCIDevicePtr dev, bool reprobe);
+int virPCIDeviceUnbind(virPCIDevicePtr dev);
 int virPCIDeviceGetDriverPathAndName(virPCIDevicePtr dev,
                                      char **path,
                                      char **name);
index f1c53694271ea17b07b00e2bcaffed5de9cdf7ff..1ade3e5e1dc9678b657457f2d8e96dbeac515089 100644 (file)
@@ -341,7 +341,7 @@ testVirPCIDeviceUnbind(const void *opaque)
     if (!dev)
         goto cleanup;
 
-    if (virPCIDeviceUnbind(dev, false) < 0)
+    if (virPCIDeviceUnbind(dev) < 0)
         goto cleanup;
 
     ret = 0;