Re: [libvirt] [PATCH v2 03/10] nodedev: udevProcessPCI: Drop syspath variable

2017-04-21 Thread Pavel Hrdina
On Thu, Apr 20, 2017 at 03:05:53PM +0200, Erik Skultety wrote:
> 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: Erik Skultety 
> ---
>  src/node_device/node_device_udev.c | 10 +++---
>  1 file changed, 3 insertions(+), 7 deletions(-)

ACK

Pavel


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH v2 03/10] nodedev: udevProcessPCI: Drop syspath variable

2017-04-20 Thread Erik Skultety
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: Erik Skultety 
---
 src/node_device/node_device_udev.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/node_device/node_device_udev.c 
b/src/node_device/node_device_udev.c
index 591da8db2..6e706a10b 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -316,7 +316,6 @@ static int udevTranslatePCIIds(unsigned int vendor,
 static int udevProcessPCI(struct udev_device *device,
   virNodeDeviceDefPtr def)
 {
-const char *syspath = NULL;
 virNodeDevCapPCIDevPtr pci_dev = >caps->data.pci_dev;
 virPCIEDeviceInfoPtr pci_express = NULL;
 virPCIDevicePtr pciDev = NULL;
@@ -324,19 +323,17 @@ static int udevProcessPCI(struct udev_device *device,
 int ret = -1;
 char *p;
 
-syspath = udev_device_get_syspath(device);
-
 if (udevGetUintProperty(device, "PCI_CLASS", _dev->class, 16) < 0)
 goto cleanup;
 
-if ((p = strrchr(syspath, '/')) == NULL ||
+if ((p = strrchr(def->sysfs_path, '/')) == NULL ||
 virStrToLong_ui(p + 1, , 16, _dev->domain) < 0 || p == NULL ||
 virStrToLong_ui(p + 1, , 16, _dev->bus) < 0 || p == NULL ||
 virStrToLong_ui(p + 1, , 16, _dev->slot) < 0 || p == NULL ||
 virStrToLong_ui(p + 1, , 16, _dev->function) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
_("failed to parse the PCI address from sysfs path: 
'%s'"),
-   syspath);
+   def->sysfs_path);
 goto cleanup;
 }
 
@@ -363,8 +360,7 @@ static int udevProcessPCI(struct udev_device *device,
 _dev->numa_node, 10) < 0)
 goto cleanup;
 
-if (nodeDeviceSysfsGetPCIRelatedDevCaps(syspath,
->caps->data.pci_dev) < 0)
+if (nodeDeviceSysfsGetPCIRelatedDevCaps(def->sysfs_path, pci_dev) < 0)
 goto cleanup;
 
 if (!(pciDev = virPCIDeviceNew(pci_dev->domain,
-- 
2.12.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list