[PATCH v9 0/6] Refactor capability search into common macros

Hans Zhang posted 6 patches 1 month ago
There is a newer version of this series
drivers/pci/access.c                          | 17 ++++
.../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                             | 68 ++------------
drivers/pci/pci.h                             | 88 +++++++++++++++++++
include/uapi/linux/pci_regs.h                 |  2 +
8 files changed, 187 insertions(+), 146 deletions(-)
[PATCH v9 0/6] Refactor capability search into common macros
Posted by Hans Zhang 1 month ago
1. Introduce generic bus config read helper function.
2. Clean up __pci_find_next_cap_ttl() readability.
3. Refactor capability search into common macros.
4. DWC/CDNS use common PCI host bridge macros for finding the
   capabilities.
5. Use cdns_pcie_find_*capability to avoid hardcode.

Changes since v8:
- Split patch.
- The patch commit message were modified.
- Other patches(4/6, 5/6, 6/6) are unchanged.

Changes since v7:
- Patch 2/5 and 3/5 compilation error resolved.
- Other patches are unchanged.

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 (6):
  PCI: Introduce generic bus config read helper function
  PCI: Clean up __pci_find_next_cap_ttl() readability
  PCI: Refactor capability search into common macros
  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.

 drivers/pci/access.c                          | 17 ++++
 .../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                             | 68 ++------------
 drivers/pci/pci.h                             | 88 +++++++++++++++++++
 include/uapi/linux/pci_regs.h                 |  2 +
 8 files changed, 187 insertions(+), 146 deletions(-)


base-commit: a24588245776dafc227243a01bfbeb8a59bafba9
-- 
2.25.1
Re: [PATCH v9 0/6] Refactor capability search into common macros
Posted by Hans Zhang 2 weeks, 5 days ago
On 2025/4/9 11:41, Hans Zhang wrote:
> 1. Introduce generic bus config read helper function.
> 2. Clean up __pci_find_next_cap_ttl() readability.
> 3. Refactor capability search into common macros.
> 4. DWC/CDNS use common PCI host bridge macros for finding the
>     capabilities.
> 5. Use cdns_pcie_find_*capability to avoid hardcode.
> 
> Changes since v8:
> - Split patch.
> - The patch commit message were modified.
> - Other patches(4/6, 5/6, 6/6) are unchanged.
> 
> Changes since v7:
> - Patch 2/5 and 3/5 compilation error resolved.
> - Other patches are unchanged.
> 
> 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 (6):
>    PCI: Introduce generic bus config read helper function
>    PCI: Clean up __pci_find_next_cap_ttl() readability
>    PCI: Refactor capability search into common macros
>    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.
> 
>   drivers/pci/access.c                          | 17 ++++
>   .../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                             | 68 ++------------
>   drivers/pci/pci.h                             | 88 +++++++++++++++++++
>   include/uapi/linux/pci_regs.h                 |  2 +
>   8 files changed, 187 insertions(+), 146 deletions(-)
> 
> 
> base-commit: a24588245776dafc227243a01bfbeb8a59bafba9


Dear all,

Gentle ping.

Best regards,
Hans