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

Hans Zhang posted 4 patches 1 month, 1 week ago
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(-)
[PATCH 0/4] PCI: dwc: designware-plat: Use common mode field in struct dw_pcie
Posted by Hans Zhang 1 month, 1 week ago
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(-)


base-commit: e75a43c7cec459a07d91ed17de4de13ede2b7758
-- 
2.34.1
Re: [PATCH 0/4] PCI: dwc: designware-plat: Use common mode field in struct dw_pcie
Posted by Manivannan Sadhasivam 4 weeks, 1 day ago
On Sat, 02 May 2026 00:10:06 +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
> 
> [...]

Applied, thanks!

[1/4] PCI: dra7xx: Use common mode field in struct dw_pcie
      commit: 3718315f58f8ad663cc9c0225e3a9f3fc365dc8c
[2/4] PCI: artpec6: Use common mode field in struct dw_pcie
      commit: 5d47f6aeffdf55524fb1130666057266a741e97e
[3/4] PCI: dwc: Use common mode field in struct dw_pcie
      commit: a8bf471f87f4c5c180641a2c6f7d82b1aa0f61fd
[4/4] PCI: keembay: Use common mode field in struct dw_pcie
      commit: f02459d0342f94fbbc6296fca0f221783d3a37de

Best regards,
-- 
Manivannan Sadhasivam <mani@kernel.org>
Re: [PATCH 0/4] PCI: dwc: designware-plat: Use common mode field in struct dw_pcie
Posted by Bjorn Helgaas 1 month, 1 week ago
[cc: xrobh->robh@kernel.org]

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@google.com>