There's a single user for it which takes an existing
virPCIDeviceAddress, passes its various bits to the
function which in turn constructs a virPCIDevice and
then copies the string representation for the caller
to use: we can use virPCIDeviceAddressAsString()
instead and avoid creating the virPCIDevice in the
first place. Since the function ends up having no
users after the change, we can just drop it.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
goto cleanup;
for (i = 0; i < *n_vfname; i++) {
- if (virPCIGetAddrString((*virt_fns)[i]->domain,
- (*virt_fns)[i]->bus,
- (*virt_fns)[i]->slot,
- (*virt_fns)[i]->function,
- &pciConfigAddr) < 0) {
- virReportSystemError(ENOSYS, "%s",
- _("Failed to get PCI Config Address String"));
+ if (!(pciConfigAddr = virPCIDeviceAddressAsString((*virt_fns)[i])))
goto cleanup;
- }
+
if (virPCIGetSysfsFile(pciConfigAddr, &pci_sysfs_device_link) < 0) {
virReportSystemError(ENOSYS, "%s",
_("Failed to get PCI SYSFS file"));
return id_str;
}
-int
-virPCIGetAddrString(unsigned int domain,
- unsigned int bus,
- unsigned int slot,
- unsigned int function,
- char **pciConfigAddr)
-{
- VIR_AUTOPTR(virPCIDevice) dev = NULL;
-
- dev = virPCIDeviceNew(domain, bus, slot, function);
- if (!dev || VIR_STRDUP(*pciConfigAddr, dev->name) < 0)
- return -1;
-
- return 0;
-}
-
char *
virPCIDeviceAddressAsString(virPCIDeviceAddressPtr addr)
{
char **pci_sysfs_device_link)
ATTRIBUTE_RETURN_CHECK;
-int virPCIGetAddrString(unsigned int domain,
- unsigned int bus,
- unsigned int slot,
- unsigned int function,
- char **pciConfigAddr)
- ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK;
-
char *virPCIDeviceAddressAsString(virPCIDeviceAddressPtr addr)
ATTRIBUTE_NONNULL(1);