Commit 01fcb7f7 authored by Jan Kiszka's avatar Jan Kiszka Committed by Bjorn Helgaas

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: default avatarJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
CC: Will Deacon <will.deacon@arm.com>
CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
parent 5bd51b35
...@@ -101,5 +101,18 @@ int pci_host_common_probe(struct platform_device *pdev, ...@@ -101,5 +101,18 @@ int pci_host_common_probe(struct platform_device *pdev,
return ret; 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; return 0;
} }
...@@ -95,5 +95,6 @@ static struct platform_driver gen_pci_driver = { ...@@ -95,5 +95,6 @@ static struct platform_driver gen_pci_driver = {
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
}, },
.probe = gen_pci_probe, .probe = gen_pci_probe,
.remove = pci_host_common_remove,
}; };
builtin_platform_driver(gen_pci_driver); builtin_platform_driver(gen_pci_driver);
...@@ -62,5 +62,6 @@ extern struct pci_ecam_ops xgene_v2_pcie_ecam_ops; /* APM X-Gene PCIe v2.x */ ...@@ -62,5 +62,6 @@ extern struct pci_ecam_ops xgene_v2_pcie_ecam_ops; /* APM X-Gene PCIe v2.x */
/* for DT-based PCI controllers that support ECAM */ /* for DT-based PCI controllers that support ECAM */
int pci_host_common_probe(struct platform_device *pdev, int pci_host_common_probe(struct platform_device *pdev,
struct pci_ecam_ops *ops); struct pci_ecam_ops *ops);
int pci_host_common_remove(struct platform_device *pdev);
#endif #endif
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment