[PATCH 11/16] qemuDomainEnsurePCIAddress: Don't pass virQEMUDriver explicitly

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

 



The function is already getting 'virDomainObj' which has already the
driver pointer present.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_domain_address.c | 13 +++++--------
 src/qemu/qemu_domain_address.h |  8 +++-----
 src/qemu/qemu_hotplug.c        | 21 ++++++++++-----------
 3 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index c43ad23cf5..9abe2b84c8 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -3034,8 +3034,7 @@ qemuAssignMemoryDeviceSlot(virDomainMemoryDef *mem,


 int
-qemuDomainAssignMemoryDeviceSlot(virQEMUDriver *driver,
-                                 virDomainObj *vm,
+qemuDomainAssignMemoryDeviceSlot(virDomainObj *vm,
                                  virDomainMemoryDef *mem)
 {
     g_autoptr(virBitmap) slotmap = NULL;
@@ -3052,7 +3051,7 @@ qemuDomainAssignMemoryDeviceSlot(virQEMUDriver *driver,

     case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM:
     case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM:
-        return qemuDomainEnsurePCIAddress(vm, &dev, driver);
+        return qemuDomainEnsurePCIAddress(vm, &dev);
         break;

     case VIR_DOMAIN_MEMORY_MODEL_NONE:
@@ -3232,8 +3231,7 @@ qemuDomainAssignAddresses(virDomainDef *def,
  */
 int
 qemuDomainEnsurePCIAddress(virDomainObj *obj,
-                           virDomainDeviceDef *dev,
-                           virQEMUDriver *driver)
+                           virDomainDeviceDef *dev)
 {
     qemuDomainObjPrivate *priv = obj->privateData;
     virDomainDeviceInfo *info = virDomainDeviceGetInfo(dev);
@@ -3241,7 +3239,7 @@ qemuDomainEnsurePCIAddress(virDomainObj *obj,
     if (!info)
         return 0;

-    qemuDomainFillDevicePCIConnectFlags(obj->def, dev, priv->qemuCaps, driver);
+    qemuDomainFillDevicePCIConnectFlags(obj->def, dev, priv->qemuCaps, priv->driver);

     qemuDomainFillDevicePCIExtensionFlags(dev, info, priv->qemuCaps);

@@ -3272,7 +3270,6 @@ qemuDomainEnsureVirtioAddress(bool *releaseAddr,
     virDomainDeviceInfo *info = virDomainDeviceGetInfo(dev);
     qemuDomainObjPrivate *priv = vm->privateData;
     virDomainCCWAddressSet *ccwaddrs = NULL;
-    virQEMUDriver *driver = priv->driver;
     int ret = -1;

     if (!info->type) {
@@ -3289,7 +3286,7 @@ qemuDomainEnsureVirtioAddress(bool *releaseAddr,
             goto cleanup;
     } else if (!info->type ||
                info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
-        if (qemuDomainEnsurePCIAddress(vm, dev, driver) < 0)
+        if (qemuDomainEnsurePCIAddress(vm, dev) < 0)
             goto cleanup;
         *releaseAddr = true;
     }
diff --git a/src/qemu/qemu_domain_address.h b/src/qemu/qemu_domain_address.h
index df7e7fca99..4c360a0f70 100644
--- a/src/qemu/qemu_domain_address.h
+++ b/src/qemu/qemu_domain_address.h
@@ -45,9 +45,8 @@ int qemuDomainAssignAddresses(virDomainDef *def,
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);

 int qemuDomainEnsurePCIAddress(virDomainObj *obj,
-                               virDomainDeviceDef *dev,
-                               virQEMUDriver *driver)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                               virDomainDeviceDef *dev)
+    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

 void qemuDomainFillDeviceIsolationGroup(virDomainDef *def,
                                        virDomainDeviceDef *dev)
@@ -56,8 +55,7 @@ void qemuDomainFillDeviceIsolationGroup(virDomainDef *def,
 void qemuDomainReleaseDeviceAddress(virDomainObj *vm,
                                     virDomainDeviceInfo *info);

-int qemuDomainAssignMemoryDeviceSlot(virQEMUDriver *driver,
-                                     virDomainObj *vm,
+int qemuDomainAssignMemoryDeviceSlot(virDomainObj *vm,
                                      virDomainMemoryDef *mem);

 void qemuDomainReleaseMemoryDeviceSlot(virDomainObj *vm,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index c4f11edf6b..d44523fe7e 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1254,7 +1254,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
         if (virDomainCCWAddressAssign(&net->info, ccwaddrs,
                                       !net->info.addr.ccw.assigned) < 0)
             goto cleanup;
-    } else if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0) {
+    } else if (qemuDomainEnsurePCIAddress(vm, &dev) < 0) {
         goto cleanup;
     }

@@ -1706,7 +1706,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver,
         /* Isolation groups are only relevant for pSeries guests */
         qemuDomainFillDeviceIsolationGroup(vm->def, &dev);

-    if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0)
+    if (qemuDomainEnsurePCIAddress(vm, &dev) < 0)
         goto error;
     releaseaddr = true;

@@ -2131,8 +2131,7 @@ qemuDomainChrRemove(virDomainDef *vmdef,
  */
 static int
 qemuDomainAttachChrDeviceAssignAddr(virDomainObj *vm,
-                                    virDomainChrDef *chr,
-                                    virQEMUDriver *driver)
+                                    virDomainChrDef *chr)
 {
     virDomainDef *def = vm->def;
     qemuDomainObjPrivate *priv = vm->privateData;
@@ -2146,7 +2145,7 @@ qemuDomainAttachChrDeviceAssignAddr(virDomainObj *vm,

     } else if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
                chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI) {
-        if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0)
+        if (qemuDomainEnsurePCIAddress(vm, &dev) < 0)
             return -1;
         return 1;

@@ -2204,7 +2203,7 @@ int qemuDomainAttachChrDevice(virQEMUDriver *driver,
     if (qemuAssignDeviceChrAlias(vmdef, chr, -1) < 0)
         goto cleanup;

-    if ((rc = qemuDomainAttachChrDeviceAssignAddr(vm, chr, driver)) < 0)
+    if ((rc = qemuDomainAttachChrDeviceAssignAddr(vm, chr)) < 0)
         goto cleanup;
     if (rc == 1)
         need_release = true;
@@ -2442,7 +2441,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver,
     if (qemuDomainDefValidateMemoryHotplug(vm->def, mem) < 0)
         goto cleanup;

-    if (qemuDomainAssignMemoryDeviceSlot(driver, vm, mem) < 0)
+    if (qemuDomainAssignMemoryDeviceSlot(vm, mem) < 0)
         goto cleanup;
     releaseaddr = true;

@@ -2777,7 +2776,7 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriver *driver,

     if (hostdev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE ||
         hostdev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
-        if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0)
+        if (qemuDomainEnsurePCIAddress(vm, &dev) < 0)
             goto cleanup;
     } else if (hostdev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
         if (!(ccwaddrs = virDomainCCWAddressSetCreateFromDomain(vm->def)))
@@ -2870,7 +2869,7 @@ qemuDomainAttachMediatedDevice(virQEMUDriver *driver,

     switch (hostdev->source.subsys.u.mdev.model) {
     case VIR_MDEV_MODEL_TYPE_VFIO_PCI:
-        if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0)
+        if (qemuDomainEnsurePCIAddress(vm, &dev) < 0)
             return -1;
         break;
     case VIR_MDEV_MODEL_TYPE_VFIO_CCW: {
@@ -3039,7 +3038,7 @@ qemuDomainAttachShmemDevice(virQEMUDriver *driver,

     if ((shmem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE ||
          shmem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
-        (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0))
+        (qemuDomainEnsurePCIAddress(vm, &dev) < 0))
         return -1;

     if (!(devProps = qemuBuildShmemDevProps(vm->def, shmem)))
@@ -3136,7 +3135,7 @@ qemuDomainAttachWatchdog(virQEMUDriver *driver,
         return -1;

     if (watchdog->model == VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB) {
-        if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0)
+        if (qemuDomainEnsurePCIAddress(vm, &dev) < 0)
             goto cleanup;
         releaseAddress = true;
     } else {
-- 
2.31.1




[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]

  Powered by Linux