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
This commit is contained in:
Ferhat Gecdogan 2021-07-01 20:09:46 +02:00 committed by Marcin Wojtas
parent 2ca21223c5
commit 8df71ea1aa

View File

@ -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