From owner-dev-commits-src-main@freebsd.org Thu Jul 1 18:13:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 91C27650079; Thu, 1 Jul 2021 18:13:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GG5th3Xmrz4hX1; Thu, 1 Jul 2021 18:13:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61D102539C; Thu, 1 Jul 2021 18:13:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 161IDWfo082030; Thu, 1 Jul 2021 18:13:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 161IDWwD082029; Thu, 1 Jul 2021 18:13:32 GMT (envelope-from git) Date: Thu, 1 Jul 2021 18:13:32 GMT Message-Id: <202107011813.161IDWwD082029@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 8df71ea1aa3b - main - tegra_pcie: use switch instead of if in tegra_pcib_pex_ctrl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8df71ea1aa3b39f84e7ee3122a333caab57c3e1a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2021 18:13:32 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=8df71ea1aa3b39f84e7ee3122a333caab57c3e1a commit 8df71ea1aa3b39f84e7ee3122a333caab57c3e1a Author: Ferhat Gecdogan AuthorDate: 2021-07-01 18:09:46 +0000 Commit: Marcin Wojtas 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