summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLey Foon Tan <lftan@altera.com>2016-06-21 16:53:12 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-16 22:16:11 +0100
commitcb3ff0382e582c823cbd2ba549b7754c6416ab78 (patch)
treea8d446af9911a0e9306dd3a7c18d696486e67139 /drivers
parent9efffbc8191dd989065d4cf12e50d2abc84bd1fb (diff)
downloadlinux-stable-cb3ff0382e582c823cbd2ba549b7754c6416ab78.tar.gz
linux-stable-cb3ff0382e582c823cbd2ba549b7754c6416ab78.tar.bz2
linux-stable-cb3ff0382e582c823cbd2ba549b7754c6416ab78.zip
PCI: altera: Check link status before retrain link
commit c622032ebc538cb3869c312ae3ad235a99da84b6 upstream. 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> Cc: Claudius Heine <claudius.heine.ext@siemens.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/host/pcie-altera.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c
index a1e782263dec..b61025ee07de 100644
--- a/drivers/pci/host/pcie-altera.c
+++ b/drivers/pci/host/pcie-altera.c
@@ -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