[PATCH v3 5/5] PCI: Make pcie_link_speed[] private to probe.c
From: Hans Zhang
Date: Wed Nov 11 2026 - 21:31:04 EST
pcie_get_link_speed() is now the only accessor for pcie_link_speed[].
Make the array static and remove its extern declaration and export so no
other code can index it directly.
Signed-off-by: Hans Zhang <18255117159@xxxxxxx>
---
drivers/pci/pci.h | 1 -
drivers/pci/probe.c | 4 +---
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 5441741bc330..04bdf3b86a56 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -118,7 +118,6 @@ struct pcie_tlp_log;
#define PCI_EXP_AER_FLAGS (PCI_EXP_DEVCTL_CERE | PCI_EXP_DEVCTL_NFERE | \
PCI_EXP_DEVCTL_FERE | PCI_EXP_DEVCTL_URRE)
-extern const unsigned char pcie_link_speed[];
unsigned char pcie_get_link_speed(unsigned int speed);
extern bool pci_early_dump;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index d0283a8158f2..b2d69de00041 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -756,7 +756,7 @@ static const unsigned char pcix_bus_speed[] = {
};
/* Indexed by PCI_EXP_LNKCAP_SLS, PCI_EXP_LNKSTA_CLS */
-const unsigned char pcie_link_speed[] = {
+static const unsigned char pcie_link_speed[] = {
PCI_SPEED_UNKNOWN, /* 0 */
PCIE_SPEED_2_5GT, /* 1 */
PCIE_SPEED_5_0GT, /* 2 */
@@ -774,8 +774,6 @@ const unsigned char pcie_link_speed[] = {
PCI_SPEED_UNKNOWN, /* E */
PCI_SPEED_UNKNOWN /* F */
};
-EXPORT_SYMBOL_GPL(pcie_link_speed);
-
/**
* pcie_get_link_speed - Get speed value from PCIe generation number
* @speed: PCIe speed (1-based: 1 = 2.5GT, 2 = 5GT, ...)
--
2.43.0