aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/pci/host/pci-host-common.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2018-05-15 11:07:06 +0200
committerBjorn Helgaas <helgaas@kernel.org>2018-05-30 11:35:23 -0500
commit01fcb7f777a9f5d216a1ff41228f15656e50fb63 (patch)
tree731cac7821859b5960d1ad2f9dccc2e6b3634aa6 /drivers/pci/host/pci-host-common.c
parentPCI: Rework of_pci_get_host_bridge_resources() to devm_of_pci_get_host_bridge_resources() (diff)
downloadwireguard-linux-01fcb7f777a9f5d216a1ff41228f15656e50fb63.tar.xz
wireguard-linux-01fcb7f777a9f5d216a1ff41228f15656e50fb63.zip
PCI: Add support for unbinding the generic PCI host controller
Add support for unbinding the generic PCI host controller. This is particularly useful when working in virtual environments where the controller may come and go, but possibly not only there. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> CC: Will Deacon <will.deacon@arm.com> CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Diffstat (limited to 'drivers/pci/host/pci-host-common.c')
-rw-r--r--drivers/pci/host/pci-host-common.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/pci/host/pci-host-common.c b/drivers/pci/host/pci-host-common.c
index 5d028f53fdcd..d8f10451f273 100644
--- a/drivers/pci/host/pci-host-common.c
+++ b/drivers/pci/host/pci-host-common.c
@@ -101,5 +101,18 @@ int pci_host_common_probe(struct platform_device *pdev,
return ret;
}
+ platform_set_drvdata(pdev, bridge->bus);
+ return 0;
+}
+
+int pci_host_common_remove(struct platform_device *pdev)
+{
+ struct pci_bus *bus = platform_get_drvdata(pdev);
+
+ pci_lock_rescan_remove();
+ pci_stop_root_bus(bus);
+ pci_remove_root_bus(bus);
+ pci_unlock_rescan_remove();
+
return 0;
}