]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
PCI: altera: Check link status before retrain link
authorLey Foon Tan <lftan@altera.com>
Tue, 21 Jun 2016 08:53:12 +0000 (16:53 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 22 Jul 2016 20:58:02 +0000 (15:58 -0500)
Check the link status before retraining.  If the link is not up, don't
bother trying to retrain it.

[bhelgaas: split code move to separate patch, changelog]
Signed-off-by: Ley Foon Tan <lftan@altera.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/host/pcie-altera.c

index a1e782263dec2da9eb4788a61eb17bb64976a239..b61025ee07de17a541b7acd2465a181fa708bcdc 100644 (file)
@@ -100,6 +100,10 @@ static bool altera_pcie_link_is_up(struct altera_pcie *pcie)
 static void altera_pcie_retrain(struct pci_dev *dev)
 {
        u16 linkcap, linkstat;
+       struct altera_pcie *pcie = dev->bus->sysdata;
+
+       if (!altera_pcie_link_is_up(pcie))
+               return;
 
        /*
         * Set the retrain bit if the PCIe rootport support > 2.5GB/s, but