Re: [PATCH 0/4] PCI: dwc: designware-plat: Use common mode field in struct dw_pcie

From: Bjorn Helgaas

Date: Fri May 01 2026 - 12:49:10 EST


[cc: xrobh->robh@xxxxxxxxxx]

On Sat, May 02, 2026 at 12:10:06AM +0800, Hans Zhang wrote:
> Several DesignWare PCIe controller drivers (dra7xx, artpec6,
> designware-plat, and keembay) duplicated the device mode field
> in their private structures, while struct dw_pcie already contains
> this field. This led to:
> 1. Data redundancy and potential inconsistencies
> 2. Increased maintenance complexity
> 3. Error-prone device type checks
>
> This series fixes these issues by:
> - Removing redundant mode fields from all four drivers
> - Standardizing on dw_pcie->mode for device type detection
> - Simplifying conditional logic in probe/suspend/resume paths
> - Ensuring consistent error reporting
>
> The changes improve code maintainability and eliminate class of bugs
> related to mode synchronization.
>
> Hans Zhang (4):
> PCI: dra7xx: Use common mode field in struct dw_pcie
> PCI: artpec6: Use common mode field in struct dw_pcie
> PCI: dwc: Use common mode field in struct dw_pcie
> PCI: keembay: Use common mode field in struct dw_pcie
>
> drivers/pci/controller/dwc/pci-dra7xx.c | 11 +++++------
> drivers/pci/controller/dwc/pcie-artpec6.c | 9 ++++-----
> drivers/pci/controller/dwc/pcie-designware-plat.c | 7 +++----
> drivers/pci/controller/dwc/pcie-keembay.c | 9 ++++-----
> 4 files changed, 16 insertions(+), 20 deletions(-)

Thanks for doing this!

Reviewed-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>