[PATCH V2 2/4] PCI: Move __pcie_update_link_speed() out of line

From: Vidya Sagar

Date: Tue Aug 11 2026 - 13:13:22 EST


__pcie_update_link_speed() records the current speed and Flit Mode state
of a bus and emits the link event trace point. It is a static inline in
drivers/pci/pci.h, but it has only two callers, pcie_update_link_speed()
in drivers/pci/probe.c and pciehp_check_link_status(), and it is never on
a hot path, so inlining buys nothing.

A subsequent change makes it re-evaluate the Device 3 Control register of
the bridge, which is more of the PCI core than belongs in a header. Move
the body to drivers/pci/probe.c and leave only a declaration behind.

No functional change intended.

Signed-off-by: Vidya Sagar <vidyas@xxxxxxxxxx>
---
V2:
* New patch as a result of splitting the V1 monolithic patch

drivers/pci/pci.h | 15 +++------------
drivers/pci/probe.c | 13 +++++++++++++
2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 68b5fb675d1c..9f55868adac8 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -676,18 +676,9 @@ enum pcie_link_change_reason {
PCIE_HOTPLUG,
};

-static inline void __pcie_update_link_speed(struct pci_bus *bus,
- enum pcie_link_change_reason reason,
- u16 linksta, u16 linksta2)
-{
- bus->cur_bus_speed = pcie_link_speed[linksta & PCI_EXP_LNKSTA_CLS];
- bus->flit_mode = (linksta2 & PCI_EXP_LNKSTA2_FLIT) ? 1 : 0;
-
- trace_pcie_link_event(bus,
- reason,
- FIELD_GET(PCI_EXP_LNKSTA_NLW, linksta),
- linksta & PCI_EXP_LNKSTA_LINK_STATUS_MASK);
-}
+void __pcie_update_link_speed(struct pci_bus *bus,
+ enum pcie_link_change_reason reason,
+ u16 linksta, u16 linksta2);

void pcie_update_link_speed(struct pci_bus *bus, enum pcie_link_change_reason reason);

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index dd0abbc63e18..60dd1efe9abb 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -827,6 +827,19 @@ const char *pci_speed_string(enum pci_bus_speed speed)
}
EXPORT_SYMBOL_GPL(pci_speed_string);

+void __pcie_update_link_speed(struct pci_bus *bus,
+ enum pcie_link_change_reason reason,
+ u16 linksta, u16 linksta2)
+{
+ bus->cur_bus_speed = pcie_link_speed[linksta & PCI_EXP_LNKSTA_CLS];
+ bus->flit_mode = (linksta2 & PCI_EXP_LNKSTA2_FLIT) ? 1 : 0;
+
+ trace_pcie_link_event(bus,
+ reason,
+ FIELD_GET(PCI_EXP_LNKSTA_NLW, linksta),
+ linksta & PCI_EXP_LNKSTA_LINK_STATUS_MASK);
+}
+
void pcie_update_link_speed(struct pci_bus *bus,
enum pcie_link_change_reason reason)
{
--
2.43.0