X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=drivers%2Fbus%2Fpci%2Fpci_common.c;h=6789748e250682beef9a7649c41aacc5899acd57;hb=e4df4d55df003957fc5afd7440e3d3192d7ce218;hp=104fdf9049119b89ce63553c95bbaec834e661de;hpb=d038355bf358f713efbb182f174e2a8a09042e2b;p=deb_dpdk.git diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index 104fdf90..6789748e 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -488,17 +488,20 @@ static struct rte_device * pci_find_device(const struct rte_device *start, rte_dev_cmp_t cmp, const void *data) { - struct rte_pci_device *dev; + const struct rte_pci_device *pstart; + struct rte_pci_device *pdev; - FOREACH_DEVICE_ON_PCIBUS(dev) { - if (start && &dev->device == start) { - start = NULL; /* starting point found */ - continue; - } - if (cmp(&dev->device, data) == 0) - return &dev->device; + if (start != NULL) { + pstart = RTE_DEV_TO_PCI_CONST(start); + pdev = TAILQ_NEXT(pstart, next); + } else { + pdev = TAILQ_FIRST(&rte_pci_bus.device_list); + } + while (pdev != NULL) { + if (cmp(&pdev->device, data) == 0) + return &pdev->device; + pdev = TAILQ_NEXT(pdev, next); } - return NULL; }