summaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/pciehp_pci.c
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2017-03-29 22:48:59 -0500
committerBjorn Helgaas <bhelgaas@google.com>2017-03-29 22:54:46 -0500
commit89ee9f7680031d7df91a1a27abac69e034c2e892 (patch)
tree4e874d870f8fd310aa954153c590f6ae93517868 /drivers/pci/hotplug/pciehp_pci.c
parentd3881e5015421a578bc328136471fcf1d02ac389 (diff)
downloadop-kernel-dev-89ee9f7680031d7df91a1a27abac69e034c2e892.zip
op-kernel-dev-89ee9f7680031d7df91a1a27abac69e034c2e892.tar.gz
PCI: Add device disconnected state
Add a new state to pci_dev to be set when it is unexpectedly disconnected. The PCI driver tear down functions can observe this new device state so they may skip operations that will fail. The pciehp and pcie-dpc drivers are aware when the link is down, so these set the flag when their handlers detect the device is disconnected. Tested-by: Krishna Dhulipala <krishnad@fb.com> Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Wei Zhang <wzhang@fb.com>
Diffstat (limited to 'drivers/pci/hotplug/pciehp_pci.c')
-rw-r--r--drivers/pci/hotplug/pciehp_pci.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c
index 9e69403..19f30a9 100644
--- a/drivers/pci/hotplug/pciehp_pci.c
+++ b/drivers/pci/hotplug/pciehp_pci.c
@@ -109,6 +109,12 @@ int pciehp_unconfigure_device(struct slot *p_slot)
break;
}
}
+ if (!presence) {
+ pci_dev_set_disconnected(dev, NULL);
+ if (pci_has_subordinate(dev))
+ pci_walk_bus(dev->subordinate,
+ pci_dev_set_disconnected, NULL);
+ }
pci_stop_and_remove_bus_device(dev);
/*
* Ensure that no new Requests will be generated from
OpenPOWER on IntegriCloud