[PATCH v1 0/3] PCI: Encapsulate pcie_link_speed array access
From: Hans Zhang
Date: Sun Mar 15 2026 - 12:01:47 EST
Hi,
This series encapsulates the pcie_link_speed array by introducing a
public helper function to_pcie_link_speed() and converting all direct
array accesses to use this helper. This improves code maintainability,
reduces exposure of internal data structures, and makes future changes
to link speed mapping easier.
Patch 1 moves to_pcie_link_speed() from pci.c to probe.c and exports it.
Patch 2 converts the sysfs show function and an inline helper in pci.h
to use the new helper.
Patch 3 removes the now-unused extern declaration of the array from pci.h.
Based on this series of patch submissions:
https://patchwork.kernel.org/project/linux-pci/cover/20260313165522.123518-1-18255117159@xxxxxxx/
Hans Zhang (3):
PCI: Move to_pcie_link_speed() to probe.c and export it
PCI: Use to_pcie_link_speed() for link speed conversion
PCI: Remove extern declaration of pcie_link_speed array
drivers/pci/pci-sysfs.c | 2 +-
drivers/pci/pci.c | 5 -----
drivers/pci/pci.h | 3 +--
drivers/pci/probe.c | 7 ++++++-
include/linux/pci.h | 1 +
5 files changed, 9 insertions(+), 9 deletions(-)
base-commit: 1c9982b4961334c1edb0745a04cabd34bc2de675
prerequisite-patch-id: 7b106b4bc491747237b75c9364a500eb8cfd31a0
prerequisite-patch-id: 0fabd60d739c45e76d4fb87cc008697f92e7164e
prerequisite-patch-id: 83fa7afd2c83f62058b212e93cfea72596389f76
prerequisite-patch-id: 145833e2f270b51817275764d5a578addf6f3709
prerequisite-patch-id: cda29dea578c6213dd799dfd7b5ae5e02c7f455d
--
2.34.1