Replace the dw_pcie_find_capability(pci, PCI_CAP_ID_EXP) calls in ls_pcie_ep_probe() and ls_pcie_ep_event_handler() with dw_pcie_get_pcie_cap().
The probe reads the Link Capabilities register to save the values configured by the Reset Configuration Word anyway, so the offset is cached there. The link down event handler runs in hardirq context and can then simply reuse the cached value instead of walking the capability list every time the link goes down. Reviewed-by: Frank Li <[email protected]> Signed-off-by: Hans Zhang <[email protected]> --- drivers/pci/controller/dwc/pci-layerscape-ep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-layerscape-ep.c b/drivers/pci/controller/dwc/pci-layerscape-ep.c index 527c57114dcf..113be247b01b 100644 --- a/drivers/pci/controller/dwc/pci-layerscape-ep.c +++ b/drivers/pci/controller/dwc/pci-layerscape-ep.c @@ -84,7 +84,7 @@ static irqreturn_t ls_pcie_ep_event_handler(int irq, void *dev_id) if (val & PEX_PF0_PME_MES_DR_LUD) { - offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); + offset = dw_pcie_get_pcie_cap(pci); /* * The values of the Maximum Link Width and Supported Link @@ -268,7 +268,7 @@ static int __init ls_pcie_ep_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pcie); - offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); + offset = dw_pcie_get_pcie_cap(pci); pcie->lnkcap = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP); ret = dw_pcie_ep_init(&pci->ep); -- 2.43.0
