commit 6240fc2a04d0b21f5d7332d7be87063b19fdaf08 Author: Bjorn Helgaas Date: Wed Jun 17 11:02:52 2015 -0500 delay diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 07aa722..2540ffb 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c @@ -325,10 +325,25 @@ static int pciehp_suspend(struct pcie_device *dev) static int pciehp_resume(struct pcie_device *dev) { + struct pci_dev *pdev = dev->port; struct controller *ctrl; struct slot *slot; + int pos; + u16 flags; u8 status; + pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); + if (!pos) { + dev_err(&pdev->dev, "PCIe capability disappeared!\n"); + goto remove; + } + + pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, &flags); + if (!(flags & PCI_EXP_FLAGS_SLOT)) { + dev_err(&pdev->dev, "slot disappeared!\n"); + goto remove; + } + ctrl = get_service_data(dev); /* reinitialize the chipset's event detection logic */ @@ -345,6 +360,10 @@ static int pciehp_resume(struct pcie_device *dev) pciehp_disable_slot(slot); mutex_unlock(&slot->hotplug_lock); return 0; + +remove: + pciehp_remove(dev); + return 0; } #endif /* PM */