From 06e318c3285fb63027aaa5596911eb067f824301 Mon Sep 17 00:00:00 2001 From: Laine Stump Date: Thu, 1 Oct 2020 14:33:17 -0400 Subject: [PATCH] util: simplify virHostdevPCISysfsPath() Apparently at some point in the past, when there were multiple types to represent PCI addresses, the function virPCIDeviceAddressGetSysfsFile() used one of those types, while virDomainHostDevDef used another. It's been quite awhile since we reduced the number of different representations of PCI address, but this function was still creating a temporary virPCIDeviceAddress, then copying the individual elements into this temporary object from the same type of object in the virDomainHostDevDef. This patch just eliminates that pointless copy. Signed-off-by: Laine Stump Reviewed-by: Erik Skultety Reviewed-by: Peter Krempa --- src/hypervisor/virhostdev.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index 69102b8ebf..120187b07a 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -285,18 +285,12 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs) return g_steal_pointer(&pcidevs); } + static int virHostdevPCISysfsPath(virDomainHostdevDefPtr hostdev, char **sysfs_path) { - virPCIDeviceAddress config_address; - - config_address.domain = hostdev->source.subsys.u.pci.addr.domain; - config_address.bus = hostdev->source.subsys.u.pci.addr.bus; - config_address.slot = hostdev->source.subsys.u.pci.addr.slot; - config_address.function = hostdev->source.subsys.u.pci.addr.function; - - return virPCIDeviceAddressGetSysfsFile(&config_address, sysfs_path); + return virPCIDeviceAddressGetSysfsFile(&hostdev->source.subsys.u.pci.addr, sysfs_path); } -- 2.47.2