]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: dra7xx: Use common mode field in struct dw_pcie
authorHans Zhang <18255117159@163.com>
Fri, 1 May 2026 16:10:07 +0000 (00:10 +0800)
committerManivannan Sadhasivam <mani@kernel.org>
Fri, 15 May 2026 17:12:53 +0000 (22:42 +0530)
Remove the redundant mode field from struct dra7xx_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@163.com>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20260501161010.71688-2-18255117159@163.com
drivers/pci/controller/dwc/pci-dra7xx.c

index cd904659c32168ee03449c313cc9c5100d7c5c33..3fc889944f021f257824b6d6fcdd478bc04c086b 100644 (file)
@@ -92,7 +92,6 @@ struct dra7xx_pcie {
        struct phy              **phy;
        struct irq_domain       *irq_domain;
        struct clk              *clk;
-       enum dw_pcie_device_mode mode;
 };
 
 struct dra7xx_pcie_of_data {
@@ -328,7 +327,7 @@ static irqreturn_t dra7xx_pcie_irq_handler(int irq, void *arg)
                dev_dbg(dev, "Link Request Reset\n");
 
        if (reg & LINK_UP_EVT) {
-               if (dra7xx->mode == DW_PCIE_EP_TYPE)
+               if (dra7xx->pci->mode == DW_PCIE_EP_TYPE)
                        dw_pcie_ep_linkup(ep);
                dev_dbg(dev, "Link-up state change\n");
        }
@@ -828,7 +827,7 @@ static int dra7xx_pcie_probe(struct platform_device *pdev)
        default:
                dev_err(dev, "INVALID device type %d\n", mode);
        }
-       dra7xx->mode = mode;
+       dra7xx->pci->mode = mode;
 
        ret = devm_request_threaded_irq(dev, irq, NULL, dra7xx_pcie_irq_handler,
                                        IRQF_SHARED | IRQF_ONESHOT,
@@ -841,7 +840,7 @@ static int dra7xx_pcie_probe(struct platform_device *pdev)
        return 0;
 
 err_deinit:
-       if (dra7xx->mode == DW_PCIE_RC_TYPE)
+       if (dra7xx->pci->mode == DW_PCIE_RC_TYPE)
                dw_pcie_host_deinit(&dra7xx->pci->pp);
        else
                dw_pcie_ep_deinit(&dra7xx->pci->ep);
@@ -865,7 +864,7 @@ static int dra7xx_pcie_suspend(struct device *dev)
        struct dw_pcie *pci = dra7xx->pci;
        u32 val;
 
-       if (dra7xx->mode != DW_PCIE_RC_TYPE)
+       if (pci->mode != DW_PCIE_RC_TYPE)
                return 0;
 
        /* clear MSE */
@@ -882,7 +881,7 @@ static int dra7xx_pcie_resume(struct device *dev)
        struct dw_pcie *pci = dra7xx->pci;
        u32 val;
 
-       if (dra7xx->mode != DW_PCIE_RC_TYPE)
+       if (pci->mode != DW_PCIE_RC_TYPE)
                return 0;
 
        /* set MSE */