提交 93476521 编写于 作者: E Erik Skultety

nodedev: udevProcessPCI: Drop syspath variable

Since we have that information provided by @def which is not a private
object, there is really no need for the variable.
Signed-off-by: NErik Skultety <eskultet@redhat.com>
上级 bfaaaf10
...@@ -316,7 +316,6 @@ static int udevTranslatePCIIds(unsigned int vendor, ...@@ -316,7 +316,6 @@ static int udevTranslatePCIIds(unsigned int vendor,
static int udevProcessPCI(struct udev_device *device, static int udevProcessPCI(struct udev_device *device,
virNodeDeviceDefPtr def) virNodeDeviceDefPtr def)
{ {
const char *syspath = NULL;
virNodeDevCapPCIDevPtr pci_dev = &def->caps->data.pci_dev; virNodeDevCapPCIDevPtr pci_dev = &def->caps->data.pci_dev;
virPCIEDeviceInfoPtr pci_express = NULL; virPCIEDeviceInfoPtr pci_express = NULL;
virPCIDevicePtr pciDev = NULL; virPCIDevicePtr pciDev = NULL;
...@@ -324,19 +323,17 @@ static int udevProcessPCI(struct udev_device *device, ...@@ -324,19 +323,17 @@ static int udevProcessPCI(struct udev_device *device,
int ret = -1; int ret = -1;
char *p; char *p;
syspath = udev_device_get_syspath(device);
if (udevGetUintProperty(device, "PCI_CLASS", &pci_dev->class, 16) < 0) if (udevGetUintProperty(device, "PCI_CLASS", &pci_dev->class, 16) < 0)
goto cleanup; goto cleanup;
if ((p = strrchr(syspath, '/')) == NULL || if ((p = strrchr(def->sysfs_path, '/')) == NULL ||
virStrToLong_ui(p + 1, &p, 16, &pci_dev->domain) < 0 || p == NULL || virStrToLong_ui(p + 1, &p, 16, &pci_dev->domain) < 0 || p == NULL ||
virStrToLong_ui(p + 1, &p, 16, &pci_dev->bus) < 0 || p == NULL || virStrToLong_ui(p + 1, &p, 16, &pci_dev->bus) < 0 || p == NULL ||
virStrToLong_ui(p + 1, &p, 16, &pci_dev->slot) < 0 || p == NULL || virStrToLong_ui(p + 1, &p, 16, &pci_dev->slot) < 0 || p == NULL ||
virStrToLong_ui(p + 1, &p, 16, &pci_dev->function) < 0) { virStrToLong_ui(p + 1, &p, 16, &pci_dev->function) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("failed to parse the PCI address from sysfs path: '%s'"), _("failed to parse the PCI address from sysfs path: '%s'"),
syspath); def->sysfs_path);
goto cleanup; goto cleanup;
} }
...@@ -363,8 +360,7 @@ static int udevProcessPCI(struct udev_device *device, ...@@ -363,8 +360,7 @@ static int udevProcessPCI(struct udev_device *device,
&pci_dev->numa_node, 10) < 0) &pci_dev->numa_node, 10) < 0)
goto cleanup; goto cleanup;
if (nodeDeviceSysfsGetPCIRelatedDevCaps(syspath, if (nodeDeviceSysfsGetPCIRelatedDevCaps(def->sysfs_path, pci_dev) < 0)
&def->caps->data.pci_dev) < 0)
goto cleanup; goto cleanup;
if (!(pciDev = virPCIDeviceNew(pci_dev->domain, if (!(pciDev = virPCIDeviceNew(pci_dev->domain,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册