[PATCH 3/4] PCI: dwc: Use common mode field in struct dw_pcie

From: Hans Zhang

Date: Fri May 01 2026 - 12:11:40 EST


Remove the redundant mode field from struct dw_plat_pcie and use the
existing mode field in struct dw_pcie instead.

This avoids duplication and prevents potential inconsistencies between
the two mode fields.

Signed-off-by: Hans Zhang <18255117159@xxxxxxx>
---
drivers/pci/controller/dwc/pcie-designware-plat.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-plat.c b/drivers/pci/controller/dwc/pcie-designware-plat.c
index d103ab759c4e..d02286678a0a 100644
--- a/drivers/pci/controller/dwc/pcie-designware-plat.c
+++ b/drivers/pci/controller/dwc/pcie-designware-plat.c
@@ -22,7 +22,6 @@

struct dw_plat_pcie {
struct dw_pcie *pci;
- enum dw_pcie_device_mode mode;
};

struct dw_plat_pcie_of_data {
@@ -118,11 +117,11 @@ static int dw_plat_pcie_probe(struct platform_device *pdev)
pci->dev = dev;

dw_plat_pcie->pci = pci;
- dw_plat_pcie->mode = mode;
+ dw_plat_pcie->pci->mode = mode;

platform_set_drvdata(pdev, dw_plat_pcie);

- switch (dw_plat_pcie->mode) {
+ switch (dw_plat_pcie->pci->mode) {
case DW_PCIE_RC_TYPE:
if (!IS_ENABLED(CONFIG_PCIE_DW_PLAT_HOST))
return -ENODEV;
@@ -148,7 +147,7 @@ static int dw_plat_pcie_probe(struct platform_device *pdev)

break;
default:
- dev_err(dev, "INVALID device type %d\n", dw_plat_pcie->mode);
+ dev_err(dev, "INVALID device type %d\n", dw_plat_pcie->pci->mode);
ret = -EINVAL;
break;
}
--
2.34.1