With all users of pcie_link_speed converted to use to_pcie_link_speed(),
the external declaration in pci.h is no longer needed. Remove it to
prevent new code from directly accessing the array and to reduce the
global symbol footprint.
Signed-off-by: Hans Zhang <18255117159@163.com>
---
drivers/pci/pci.h | 1 -
drivers/pci/probe.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 053fc245a1e3..b2f91409b439 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -107,7 +107,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 40f2185ac3b5..0c93eff80b71 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -781,7 +781,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
--
2.34.1
On Mon, Mar 16, 2026 at 12:00:57AM +0800, Hans Zhang wrote:
> With all users of pcie_link_speed converted to use to_pcie_link_speed(),
> the external declaration in pci.h is no longer needed. Remove it to
> prevent new code from directly accessing the array and to reduce the
> global symbol footprint.
>
> Signed-off-by: Hans Zhang <18255117159@163.com>
> ---
> drivers/pci/pci.h | 1 -
> drivers/pci/probe.c | 1 -
> 2 files changed, 2 deletions(-)
>
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index 053fc245a1e3..b2f91409b439 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -107,7 +107,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[];
What about controller drivers using this array?
git grep -r "pcie_link_speed\[" drivers/pci/controller/
drivers/pci/controller/dwc/pcie-designware-host.c: enum pci_bus_speed speed = pcie_link_speed[pci->max_link_speed];
drivers/pci/controller/dwc/pcie-designware.c: switch (pcie_link_speed[pci->max_link_speed]) {
drivers/pci/controller/dwc/pcie-qcom-common.c: for (speed = PCIE_SPEED_8_0GT; speed <= pcie_link_speed[pci->max_link_speed]; speed++) {
drivers/pci/controller/dwc/pcie-qcom-ep.c: Mbps_to_icc(PCIE_SPEED2MBS_ENC(pcie_link_speed[speed]))
drivers/pci/controller/dwc/pcie-qcom-ep.c: if (pcie_link_speed[pci->max_link_speed] == PCIE_SPEED_16_0GT)
drivers/pci/controller/dwc/pcie-qcom.c: Mbps_to_icc(PCIE_SPEED2MBS_ENC(pcie_link_speed[speed]))
drivers/pci/controller/dwc/pcie-qcom.c: if (pcie_link_speed[pci->max_link_speed] == PCIE_SPEED_16_0GT)
drivers/pci/controller/dwc/pcie-qcom.c: freq_mbps = pcie_dev_speed_mbps(pcie_link_speed[speed]);
drivers/pci/controller/dwc/pcie-tegra194.c: val = width * PCIE_SPEED2MBS_ENC(pcie_link_speed[speed]);
drivers/pci/controller/pcie-brcmstb.c: pci_speed_string(pcie_link_speed[cls]), nlw,
drivers/pci/controller/pcie-rzg3s-host.c: switch (pcie_link_speed[host->max_link_speed]) {
- Mani
--
மணிவண்ணன் சதாசிவம்
On 4/5/26 00:41, Manivannan Sadhasivam wrote:
> On Mon, Mar 16, 2026 at 12:00:57AM +0800, Hans Zhang wrote:
>> With all users of pcie_link_speed converted to use to_pcie_link_speed(),
>> the external declaration in pci.h is no longer needed. Remove it to
>> prevent new code from directly accessing the array and to reduce the
>> global symbol footprint.
>>
>> Signed-off-by: Hans Zhang <18255117159@163.com>
>> ---
>> drivers/pci/pci.h | 1 -
>> drivers/pci/probe.c | 1 -
>> 2 files changed, 2 deletions(-)
>>
>> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
>> index 053fc245a1e3..b2f91409b439 100644
>> --- a/drivers/pci/pci.h
>> +++ b/drivers/pci/pci.h
>> @@ -107,7 +107,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[];
>
> What about controller drivers using this array?
Hi Mani,
The following call has been accepted by the following branch.
https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/log/?h=controller/max-link-speed
The main purpose of this series is to prevent the pcie_link_speed array
from being exposed.
Best regards,
Hans
>
> git grep -r "pcie_link_speed\[" drivers/pci/controller/
> drivers/pci/controller/dwc/pcie-designware-host.c: enum pci_bus_speed speed = pcie_link_speed[pci->max_link_speed];
> drivers/pci/controller/dwc/pcie-designware.c: switch (pcie_link_speed[pci->max_link_speed]) {
> drivers/pci/controller/dwc/pcie-qcom-common.c: for (speed = PCIE_SPEED_8_0GT; speed <= pcie_link_speed[pci->max_link_speed]; speed++) {
> drivers/pci/controller/dwc/pcie-qcom-ep.c: Mbps_to_icc(PCIE_SPEED2MBS_ENC(pcie_link_speed[speed]))
> drivers/pci/controller/dwc/pcie-qcom-ep.c: if (pcie_link_speed[pci->max_link_speed] == PCIE_SPEED_16_0GT)
> drivers/pci/controller/dwc/pcie-qcom.c: Mbps_to_icc(PCIE_SPEED2MBS_ENC(pcie_link_speed[speed]))
> drivers/pci/controller/dwc/pcie-qcom.c: if (pcie_link_speed[pci->max_link_speed] == PCIE_SPEED_16_0GT)
> drivers/pci/controller/dwc/pcie-qcom.c: freq_mbps = pcie_dev_speed_mbps(pcie_link_speed[speed]);
> drivers/pci/controller/dwc/pcie-tegra194.c: val = width * PCIE_SPEED2MBS_ENC(pcie_link_speed[speed]);
> drivers/pci/controller/pcie-brcmstb.c: pci_speed_string(pcie_link_speed[cls]), nlw,
> drivers/pci/controller/pcie-rzg3s-host.c: switch (pcie_link_speed[host->max_link_speed]) {
>
> - Mani
>
© 2016 - 2026 Red Hat, Inc.