aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-09-17 22:16:11 -0700
committerYinghai Lu <yinghai@kernel.org>2012-09-17 22:16:11 -0700
commit931ef7b01915164022f09dbbfa6308d959ef675d (patch)
treef7fc1d5068460d8711755c6d82d3ebed2e78368c
parentb95948ab4d283614bc0d88031559ce74c6701645 (diff)
downloadlinux-yinghai-931ef7b01915164022f09dbbfa6308d959ef675d.tar.gz
PCI, ACPI: Make acpi_pci_root_remove remove pci root bus too
It will call new added pci_stop_and_remove_bus() to stop/remove pci root bus. Also checking if that pci_root_bus get removed already in bus remove in /sys Signed-off-by: Yinghai Lu <yinghai@kernel.org> Cc: Len Brown <lenb@kernel.org> Cc: linux-acpi@vger.kernel.org
-rw-r--r--drivers/acpi/pci_root.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 3d92c0ea270b46..92ec5c90e4f619 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -652,10 +652,26 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type)
{
struct acpi_pci_root *root = acpi_driver_data(device);
+ /* that root bus could be removed already */
+ if (!pci_find_bus(root->segment, root->secondary.start)) {
+ dev_printk(KERN_DEBUG, &device->dev,
+ "freeing acpi_pci_root, but pci root bus was removed before");
+ goto out;
+ }
+
+ pci_stop_root_bus(root->bus);
+
device_set_run_wake(root->bus->bridge, false);
pci_acpi_remove_bus_pm_notifier(device);
+ dev_printk(KERN_DEBUG, &device->dev,
+ "freeing acpi_pci_root, will remove pci root bus at first");
+ pci_remove_root_bus(root->bus);
+
+out:
+ list_del(&root->node);
kfree(root);
+
return 0;
}