From 5886eacea292e39271f42f067132fa9265e093dd Mon Sep 17 00:00:00 2001 Message-Id: <5886eacea292e39271f42f067132fa9265e093dd@dist-git> From: Andrea Bolognani Date: Mon, 17 Jul 2017 12:09:00 +0200 Subject: [PATCH] qemu: Clean up qemuDomainAttachHostPCIDevice() We use hostdev->info frequently enough that having a shorter name for it makes the code more readable. We will also be adding even more uses later on. Signed-off-by: Andrea Bolognani Reviewed-by: Laine Stump (cherry picked from commit 765421723237aa93441b404ac8b0e67e6d2f636e) Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1431193 Signed-off-by: Andrea Bolognani Signed-off-by: Jiri Denemark --- src/qemu/qemu_hotplug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index a6274273dd..316bc7d41e 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1390,6 +1390,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, qemuDomainObjPrivatePtr priv = vm->privateData; virDomainDeviceDef dev = { VIR_DOMAIN_DEVICE_HOSTDEV, { .hostdev = hostdev } }; + virDomainDeviceInfoPtr info = hostdev->info; int ret; char *devstr = NULL; int configfd = -1; @@ -1462,7 +1463,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, if (backend != VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) teardownlabel = true; - if (qemuAssignDeviceHostdevAlias(vm->def, &hostdev->info->alias, -1) < 0) + if (qemuAssignDeviceHostdevAlias(vm->def, &info->alias, -1) < 0) goto error; if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0) goto error; @@ -1471,8 +1472,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_PCI_CONFIGFD)) { configfd = qemuOpenPCIConfig(hostdev); if (configfd >= 0) { - if (virAsprintf(&configfd_name, "fd-%s", - hostdev->info->alias) < 0) + if (virAsprintf(&configfd_name, "fd-%s", info->alias) < 0) goto error; } } @@ -1517,7 +1517,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, VIR_WARN("Unable to remove host device from /dev"); if (releaseaddr) - qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL); + qemuDomainReleaseDeviceAddress(vm, info, NULL); qemuHostdevReAttachPCIDevices(driver, vm->def->name, &hostdev, 1); -- 2.13.3