Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Jul 2021 18:13:32 GMT
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 8df71ea1aa3b - main - tegra_pcie: use switch instead of if in tegra_pcib_pex_ctrl
Message-ID:  <202107011813.161IDWwD082029@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mw:

URL: https://cgit.FreeBSD.org/src/commit/?id=8df71ea1aa3b39f84e7ee3122a333caab57c3e1a

commit 8df71ea1aa3b39f84e7ee3122a333caab57c3e1a
Author:     Ferhat Gecdogan <ferhatgec@users.noreply.github.com>
AuthorDate: 2021-07-01 18:09:46 +0000
Commit:     Marcin Wojtas <mw@FreeBSD.org>
CommitDate: 2021-07-01 18:09:46 +0000

    tegra_pcie: use switch instead of if in tegra_pcib_pex_ctrl
    
    Simplify obtaining per-port data in tegra_pcib_pex_ctrl() routine.
    
    Reviewed by:    imp, mw
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/481
---
 sys/arm/nvidia/tegra_pcie.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/sys/arm/nvidia/tegra_pcie.c b/sys/arm/nvidia/tegra_pcie.c
index aa488bb8c0e4..ec8f361cff7f 100644
--- a/sys/arm/nvidia/tegra_pcie.c
+++ b/sys/arm/nvidia/tegra_pcie.c
@@ -835,17 +835,16 @@ tegra_pcib_msi_map_msi(device_t dev, device_t child, struct intr_irqsrc *isrc,
 static bus_size_t
 tegra_pcib_pex_ctrl(struct tegra_pcib_softc *sc, int port)
 {
-	if (port >= TEGRA_PCIB_MAX_PORTS)
-		panic("invalid port number: %d\n", port);
-
-	if (port == 0)
+	switch (port) {
+	case 0:
 		return (AFI_PEX0_CTRL);
-	else if (port == 1)
+	case 1:
 		return (AFI_PEX1_CTRL);
-	else if (port == 2)
+	case 2:
 		return (AFI_PEX2_CTRL);
-	else
+	default:
 		panic("invalid port number: %d\n", port);
+	}
 }
 
 static int



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107011813.161IDWwD082029>