summaryrefslogtreecommitdiffstats
path: root/drivers/pci/pcie/pcie-dpc.c
diff options
context:
space:
mode:
authorKeith Busch2017-03-30 05:48:59 +0200
committerBjorn Helgaas2017-03-30 05:54:46 +0200
commit89ee9f7680031d7df91a1a27abac69e034c2e892 (patch)
tree4e874d870f8fd310aa954153c590f6ae93517868 /drivers/pci/pcie/pcie-dpc.c
parentPCI: Export PCI device config accessors (diff)
downloadkernel-qcow2-linux-89ee9f7680031d7df91a1a27abac69e034c2e892.tar.gz
kernel-qcow2-linux-89ee9f7680031d7df91a1a27abac69e034c2e892.tar.xz
kernel-qcow2-linux-89ee9f7680031d7df91a1a27abac69e034c2e892.zip
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/pcie/pcie-dpc.c')
-rw-r--r--drivers/pci/pcie/pcie-dpc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/pci/pcie/pcie-dpc.c b/drivers/pci/pcie/pcie-dpc.c
index d4d70ef4a2d7..77d2ca99d2ec 100644
--- a/drivers/pci/pcie/pcie-dpc.c
+++ b/drivers/pci/pcie/pcie-dpc.c
@@ -14,6 +14,7 @@
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/pcieport_if.h>
+#include "../pci.h"
struct dpc_dev {
struct pcie_device *dev;
@@ -66,6 +67,10 @@ static void interrupt_event_handler(struct work_struct *work)
list_for_each_entry_safe_reverse(dev, temp, &parent->devices,
bus_list) {
pci_dev_get(dev);
+ 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);
pci_dev_put(dev);
}