[03/12] eal/pci: Rework loops in rte_pci_get_iommu_class
diff mbox series

Message ID 20190530174819.1160221-4-benjamin.walker@intel.com
State Superseded, archived
Headers show
Series
  • [01/12] eal: Make rte_eal_using_phys_addrs work sooner
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Ben Walker May 30, 2019, 5:48 p.m. UTC
Make all of the loops first iterate over devices, then
drivers. This is in preparation for combining them
into a single loop.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Ifb2bfcc60570a5d5a13481be3da0fc74bf00ef1f
---
 drivers/bus/pci/linux/pci.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Patch
diff mbox series

diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index d3177916a..70815e4f0 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -589,10 +589,10 @@  rte_pci_get_iommu_class(void)
 	if (!is_bound)
 		return RTE_IOVA_DC;
 
-	FOREACH_DRIVER_ON_PCIBUS(drv) {
-		if (drv && drv->drv_flags & RTE_PCI_DRV_IOVA_AS_VA) {
-			FOREACH_DEVICE_ON_PCIBUS(dev) {
-				if (dev->kdrv == RTE_KDRV_VFIO &&
+	FOREACH_DEVICE_ON_PCIBUS(dev) {
+		if (dev->kdrv == RTE_KDRV_VFIO) {
+			FOREACH_DRIVER_ON_PCIBUS(drv) {
+				if (drv->drv_flags & RTE_PCI_DRV_IOVA_AS_VA &&
 				    rte_pci_match(drv, dev)) {
 					has_iova_va = true;
 					break;
@@ -631,8 +631,8 @@  rte_pci_get_iommu_class(void)
 	}
 
 	break_out = false;
-	FOREACH_DRIVER_ON_PCIBUS(drv) {
-		FOREACH_DEVICE_ON_PCIBUS(dev) {
+	FOREACH_DEVICE_ON_PCIBUS(dev) {
+		FOREACH_DRIVER_ON_PCIBUS(drv) {
 			if (!rte_pci_match(drv, dev))
 				continue;
 			/*