summaryrefslogtreecommitdiff
path: root/drivers/pci/pci.h
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2024-10-18 17:47:50 +0300
committerBjorn Helgaas <bhelgaas@google.com>2024-11-11 14:20:04 -0600
commite93d9fcfd7dc643eb5fce43053774d27bea2b263 (patch)
tree5fdf6b1b097a165b922fd3f4f81c1dab6e062043 /drivers/pci/pci.h
parentd2bd39c0456b75be9dfc7d774b8d021355c26ae3 (diff)
downloadlinux-e93d9fcfd7dc643eb5fce43053774d27bea2b263.tar.gz
linux-e93d9fcfd7dc643eb5fce43053774d27bea2b263.tar.bz2
linux-e93d9fcfd7dc643eb5fce43053774d27bea2b263.zip
PCI: Refactor pcie_update_link_speed()
pcie_update_link_speed() is passed the Link Status register but not all callers have that value at hand nor need the value. Refactor pcie_update_link_speed() to include reading the Link Status register and create __pcie_update_link_speed() which can be used by the hotplug code that has the register value at hand beforehand (and needs the value for other purposes). Link: https://lore.kernel.org/r/20241018144755.7875-5-ilpo.jarvinen@linux.intel.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/pci/pci.h')
-rw-r--r--drivers/pci/pci.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index d0a46ecf7289..8137ad2fead8 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -379,7 +379,12 @@ enum pci_bus_speed pcie_get_speed_cap(struct pci_dev *dev);
enum pcie_link_width pcie_get_width_cap(struct pci_dev *dev);
void __pcie_print_link_status(struct pci_dev *dev, bool verbose);
void pcie_report_downtraining(struct pci_dev *dev);
-void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
+
+static inline void __pcie_update_link_speed(struct pci_bus *bus, u16 linksta)
+{
+ bus->cur_bus_speed = pcie_link_speed[linksta & PCI_EXP_LNKSTA_CLS];
+}
+void pcie_update_link_speed(struct pci_bus *bus);
/* Single Root I/O Virtualization */
struct pci_sriov {