]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
PCI: Add preceding capability position support in PCI_FIND_NEXT_*_CAP macros
authorQiang Yu <qiang.yu@oss.qualcomm.com>
Mon, 10 Nov 2025 06:59:40 +0000 (22:59 -0800)
committerManivannan Sadhasivam <mani@kernel.org>
Thu, 18 Dec 2025 07:16:16 +0000 (12:46 +0530)
commita2582e05e39adf9ab82a02561cd6f70738540ae0
tree2e7f355a4ccac7310431c2913e1bf60f95277fae
parent8f0b4cce4481fb22653697cced8d0d04027cb1e8
PCI: Add preceding capability position support in PCI_FIND_NEXT_*_CAP macros

Add support for finding the preceding capability position in PCI
capability list by extending the capability finding macros with an
additional parameter. This functionality is essential for modifying PCI
capability list, as it provides the necessary information to update the
"next" pointer of the predecessor capability when removing entries.

Modify two macros to accept a new 'prev_ptr' parameter:
- PCI_FIND_NEXT_CAP - Now accepts 'prev_ptr' parameter for standard
  capabilities
- PCI_FIND_NEXT_EXT_CAP - Now accepts 'prev_ptr' parameter for extended
  capabilities

When a capability is found, these macros:
- Store the position of the preceding capability in *prev_ptr
  (if prev_ptr != NULL)
- Maintain all existing functionality when prev_ptr is NULL

Update current callers to accommodate this API change by passing NULL to
'prev_ptr' argument if they do not care about the preceding capability
position.

No functional changes to driver behavior result from this commit as it
maintains the existing capability finding functionality while adding the
infrastructure for future capability removal operations.

Signed-off-by: Qiang Yu <qiang.yu@oss.qualcomm.com>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Link: https://patch.msgid.link/20251109-remove_cap-v1-1-2208f46f4dc2@oss.qualcomm.com
drivers/pci/controller/cadence/pcie-cadence.c
drivers/pci/controller/dwc/pcie-designware-ep.c
drivers/pci/controller/dwc/pcie-designware.c
drivers/pci/pci.c
drivers/pci/pci.h