summaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorKrishna chaitanya chundru <quic_krichai@quicinc.com>2024-06-19 17:11:12 +0200
committerBjorn Helgaas <bhelgaas@google.com>2024-07-09 23:56:36 +0200
commit100ae5d77f07f9f046106e228778c7aa1c6d3af3 (patch)
tree8f2f8f8ffcfd45b7149b08ef778eff576170e87b /drivers/pci/pci.c
parentPCI: qcom: Add ICC bandwidth vote for CPU to PCIe path (diff)
downloadlinux-100ae5d77f07f9f046106e228778c7aa1c6d3af3.tar.xz
linux-100ae5d77f07f9f046106e228778c7aa1c6d3af3.zip
PCI: Bring the PCIe speed to MBps logic to new pcie_dev_speed_mbps()
Bring the switch case in pcie_link_speed_mbps() to new function to the header file so that it can be used in other places like in controller driver. Link: https://lore.kernel.org/linux-pci/20240619-opp_support-v15-3-aa769a2173a3@quicinc.com Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 59e0949fb079..ac28b5d34648 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -6020,24 +6020,7 @@ int pcie_link_speed_mbps(struct pci_dev *pdev)
if (err)
return err;
- switch (to_pcie_link_speed(lnksta)) {
- case PCIE_SPEED_2_5GT:
- return 2500;
- case PCIE_SPEED_5_0GT:
- return 5000;
- case PCIE_SPEED_8_0GT:
- return 8000;
- case PCIE_SPEED_16_0GT:
- return 16000;
- case PCIE_SPEED_32_0GT:
- return 32000;
- case PCIE_SPEED_64_0GT:
- return 64000;
- default:
- break;
- }
-
- return -EINVAL;
+ return pcie_dev_speed_mbps(to_pcie_link_speed(lnksta));
}
EXPORT_SYMBOL(pcie_link_speed_mbps);