aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/pci_root.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/pci_root.c')
-rw-r--r--drivers/acpi/pci_root.c48
1 files changed, 1 insertions, 47 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 6ae5e440436e..ac8688b89705 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -65,44 +65,12 @@ static struct acpi_scan_handler pci_root_handler = {
65 .detach = acpi_pci_root_remove, 65 .detach = acpi_pci_root_remove,
66}; 66};
67 67
68/* Lock to protect both acpi_pci_roots and acpi_pci_drivers lists */ 68/* Lock to protect both acpi_pci_roots lists */
69static DEFINE_MUTEX(acpi_pci_root_lock); 69static DEFINE_MUTEX(acpi_pci_root_lock);
70static LIST_HEAD(acpi_pci_roots); 70static LIST_HEAD(acpi_pci_roots);
71static LIST_HEAD(acpi_pci_drivers);
72 71
73static DEFINE_MUTEX(osc_lock); 72static DEFINE_MUTEX(osc_lock);
74 73
75int acpi_pci_register_driver(struct acpi_pci_driver *driver)
76{
77 int n = 0;
78 struct acpi_pci_root *root;
79
80 mutex_lock(&acpi_pci_root_lock);
81 list_add_tail(&driver->node, &acpi_pci_drivers);
82 if (driver->add)
83 list_for_each_entry(root, &acpi_pci_roots, node) {
84 driver->add(root);
85 n++;
86 }
87 mutex_unlock(&acpi_pci_root_lock);
88
89 return n;
90}
91EXPORT_SYMBOL(acpi_pci_register_driver);
92
93void acpi_pci_unregister_driver(struct acpi_pci_driver *driver)
94{
95 struct acpi_pci_root *root;
96
97 mutex_lock(&acpi_pci_root_lock);
98 list_del(&driver->node);
99 if (driver->remove)
100 list_for_each_entry(root, &acpi_pci_roots, node)
101 driver->remove(root);
102 mutex_unlock(&acpi_pci_root_lock);
103}
104EXPORT_SYMBOL(acpi_pci_unregister_driver);
105
106/** 74/**
107 * acpi_is_root_bridge - determine whether an ACPI CA node is a PCI root bridge 75 * acpi_is_root_bridge - determine whether an ACPI CA node is a PCI root bridge
108 * @handle - the ACPI CA node in question. 76 * @handle - the ACPI CA node in question.
@@ -413,7 +381,6 @@ static int acpi_pci_root_add(struct acpi_device *device,
413 acpi_status status; 381 acpi_status status;
414 int result; 382 int result;
415 struct acpi_pci_root *root; 383 struct acpi_pci_root *root;
416 struct acpi_pci_driver *driver;
417 u32 flags, base_flags; 384 u32 flags, base_flags;
418 385
419 root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); 386 root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL);
@@ -571,12 +538,6 @@ static int acpi_pci_root_add(struct acpi_device *device,
571 pci_assign_unassigned_bus_resources(root->bus); 538 pci_assign_unassigned_bus_resources(root->bus);
572 } 539 }
573 540
574 mutex_lock(&acpi_pci_root_lock);
575 list_for_each_entry(driver, &acpi_pci_drivers, node)
576 if (driver->add)
577 driver->add(root);
578 mutex_unlock(&acpi_pci_root_lock);
579
580 /* need to after hot-added ioapic is registered */ 541 /* need to after hot-added ioapic is registered */
581 if (system_state != SYSTEM_BOOTING) 542 if (system_state != SYSTEM_BOOTING)
582 pci_enable_bridges(root->bus); 543 pci_enable_bridges(root->bus);
@@ -597,16 +558,9 @@ end:
597static void acpi_pci_root_remove(struct acpi_device *device) 558static void acpi_pci_root_remove(struct acpi_device *device)
598{ 559{
599 struct acpi_pci_root *root = acpi_driver_data(device); 560 struct acpi_pci_root *root = acpi_driver_data(device);
600 struct acpi_pci_driver *driver;
601 561
602 pci_stop_root_bus(root->bus); 562 pci_stop_root_bus(root->bus);
603 563
604 mutex_lock(&acpi_pci_root_lock);
605 list_for_each_entry_reverse(driver, &acpi_pci_drivers, node)
606 if (driver->remove)
607 driver->remove(root);
608 mutex_unlock(&acpi_pci_root_lock);
609
610 device_set_run_wake(root->bus->bridge, false); 564 device_set_run_wake(root->bus->bridge, false);
611 pci_acpi_remove_bus_pm_notifier(device); 565 pci_acpi_remove_bus_pm_notifier(device);
612 566