[09/12] eal/pci: Simplify rte_pci_get_iommu class by using a switch
diff mbox series

Message ID 20190530174819.1160221-10-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
Take several independent if statements and convert to a
switch statement.

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

Patch
diff mbox series

diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 11e2e4d1b..41fd82988 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -601,12 +601,12 @@  rte_pci_get_iommu_class(void)
 		if (pci_ignore_device(dev))
 			continue;
 
-		if (dev->kdrv != RTE_KDRV_UNKNOWN &&
-		    dev->kdrv != RTE_KDRV_NONE) {
+		switch (dev->kdrv) {
+		case RTE_KDRV_UNKNOWN:
+		case RTE_KDRV_NONE:
+			break;
+		case RTE_KDRV_VFIO:
 			is_bound = true;
-		}
-
-		if (dev->kdrv == RTE_KDRV_VFIO) {
 			FOREACH_DRIVER_ON_PCIBUS(drv) {
 				if (!rte_pci_match(drv, dev))
 					continue;
@@ -622,11 +622,14 @@  rte_pci_get_iommu_class(void)
 					break;
 				}
 			}
-		}
-
-		if (dev->kdrv == RTE_KDRV_IGB_UIO ||
-		   dev->kdrv == RTE_KDRV_UIO_GENERIC) {
+			break;
+		case RTE_KDRV_IGB_UIO:
+		case RTE_KDRV_UIO_GENERIC:
+		case RTE_KDRV_NIC_UIO:
+			is_bound = true;
 			is_bound_uio = true;
+			break;
+
 		}
 	}