[v7 0/5] Refactor capability search into common macros

Hans Zhang
2025-04-02T04:21:18Z

1. Refactor capability search into common macros.
2. Refactor capability search functions to eliminate code duplication.
2. DWC/CDNS use common PCI host bridge macros for finding the
capabilities.
3. Use cdns_pcie_find_*capability to avoid hardcode.

Changes since v6:
- Refactor capability search into common macros.
- Delete pci-host-helpers.c and MAINTAINERS.

Changes since v5:
- If you put the helpers in drivers/pci/pci.c, they unnecessarily enlarge
the kernel's .text section even if it's known already at compile time
that they're never going to be used (e.g. on x86).
- Move the API for find capabilitys to a new file called
pci-host-helpers.c.
- Add new patch for MAINTAINERS.

Changes since v4:
- Resolved [v4 1/4] compilation warning.
- The patch subject and commit message were modified.

Changes since v3:
- Resolved [v3 1/4] compilation error.
- Other patches are not modified.

Changes since v2:
- Add and split into a series of patches.

Hans Zhang (5):
PCI: Refactor capability search into common macros
PCI: Refactor capability search functions to eliminate code
duplication
PCI: dwc: Use common PCI host bridge APIs for finding the capabilities
PCI: cadence: Use common PCI host bridge APIs for finding the
capabilities
PCI: cadence: Use cdns_pcie_find_*capability to avoid hardcode.

.../pci/controller/cadence/pcie-cadence-ep.c | 40 +++++----
drivers/pci/controller/cadence/pcie-cadence.c | 28 +++++++
drivers/pci/controller/cadence/pcie-cadence.h | 18 +++--
drivers/pci/controller/dwc/pcie-designware.c | 72 ++---------------
drivers/pci/pci.c | 79 +++++-------------
drivers/pci/pci.h | 81 +++++++++++++++++++
include/uapi/linux/pci_regs.h | 2 +
7 files changed, 176 insertions(+), 144 deletions(-)

base-commit: acb4f33713b9f6cadb6143f211714c343465411c
--
2.25.1