From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Hans Zhang <18255117159@163.com>
Cc: bhelgaas@google.com, mani@kernel.org, lpieralisi@kernel.org,
kwilczynski@kernel.org, thierry.reding@kernel.org,
ryder.lee@mediatek.com, jonathanh@nvidia.com, robh@kernel.org,
linux-pci@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
linux-mediatek@lists.infradead.org, linux-tegra@vger.kernel.org
Subject: Re: [PATCH v3 1/5] PCI: Use pcie_get_link_speed() in pci.c
Date: Thu, 12 Nov 2026 12:25:19 +0200 (EET) [thread overview]
Message-ID: <0c4e7529-c658-f841-8967-d32252e83dc5@linux.intel.com> (raw)
In-Reply-To: <20261112022405.1230200-2-18255117159@163.com>
[-- Attachment #1: Type: text/plain, Size: 2612 bytes --]
On Thu, 12 Nov 2026, Hans Zhang wrote:
> Replace the to_pcie_link_speed() wrapper with pcie_get_link_speed() in
> pcie_link_bandwidth_mbps() and pcie_bandwidth_available(), and remove
> the now-unused wrapper. pcie_get_link_speed() performs the same lookup
now unused
I suppose Bjorn can take care of that while applying so no need to send
another version because of this alone.
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
--
i.
> with bounds checking and is already exported.
>
> Signed-off-by: Hans Zhang <18255117159@163.com>
> ---
> drivers/pci/pci.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 7c6f2aba8144..594ee7aa4cad 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -6025,11 +6025,6 @@ int pcie_set_mps(struct pci_dev *dev, int mps)
> }
> EXPORT_SYMBOL(pcie_set_mps);
>
> -static enum pci_bus_speed to_pcie_link_speed(u16 lnksta)
> -{
> - return pcie_link_speed[FIELD_GET(PCI_EXP_LNKSTA_CLS, lnksta)];
> -}
> -
> /**
> * pcie_link_bandwidth_mbps - get the current bandwidth of a single PCIe link
> * @pdev: PCI device to query
> @@ -6041,14 +6036,15 @@ static enum pci_bus_speed to_pcie_link_speed(u16 lnksta)
> */
> int pcie_link_bandwidth_mbps(struct pci_dev *pdev)
> {
> - u16 lnksta;
> + u16 lnksta, lnksta_cls;
> int speed, err;
>
> err = pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnksta);
> if (err)
> return pcibios_err_to_errno(err);
>
> - speed = pcie_dev_speed_mbps(to_pcie_link_speed(lnksta));
> + lnksta_cls = FIELD_GET(PCI_EXP_LNKSTA_CLS, lnksta);
> + speed = pcie_dev_speed_mbps(pcie_get_link_speed(lnksta_cls));
> if (speed < 0)
> return speed;
>
> @@ -6074,7 +6070,7 @@ u32 pcie_bandwidth_available(struct pci_dev *dev, struct pci_dev **limiting_dev,
> enum pci_bus_speed *speed,
> enum pcie_link_width *width)
> {
> - u16 lnksta;
> + u16 lnksta, lnksta_cls;
> enum pci_bus_speed next_speed;
> enum pcie_link_width next_width;
> u32 bw, next_bw;
> @@ -6089,7 +6085,8 @@ u32 pcie_bandwidth_available(struct pci_dev *dev, struct pci_dev **limiting_dev,
> while (dev) {
> pcie_capability_read_word(dev, PCI_EXP_LNKSTA, &lnksta);
>
> - next_speed = to_pcie_link_speed(lnksta);
> + lnksta_cls = FIELD_GET(PCI_EXP_LNKSTA_CLS, lnksta);
> + next_speed = pcie_get_link_speed(lnksta_cls);
> next_width = FIELD_GET(PCI_EXP_LNKSTA_NLW, lnksta);
>
> next_bw = next_width * PCIE_SPEED2MBS_ENC(next_speed);
>
next prev parent reply other threads:[~2026-11-12 10:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 2:24 [PATCH v3 0/5] PCI: Encapsulate pcie_link_speed array access Hans Zhang
2026-11-12 2:24 ` [PATCH v3 1/5] PCI: Use pcie_get_link_speed() in pci.c Hans Zhang
2026-11-12 10:25 ` Ilpo Järvinen [this message]
2026-11-12 2:24 ` [PATCH v3 2/5] PCI: Convert remaining core pcie_link_speed[] users Hans Zhang
2026-11-12 2:24 ` [PATCH v3 3/5] PCI: tegra264: Use pcie_get_link_speed() Hans Zhang
2026-11-12 2:24 ` [PATCH v3 4/5] PCI: mediatek: " Hans Zhang
2026-11-12 2:24 ` [PATCH v3 5/5] PCI: Make pcie_link_speed[] private to probe.c Hans Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0c4e7529-c658-f841-8967-d32252e83dc5@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=18255117159@163.com \
--cc=bhelgaas@google.com \
--cc=jonathanh@nvidia.com \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=robh@kernel.org \
--cc=ryder.lee@mediatek.com \
--cc=thierry.reding@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®