]> Pileus Git - ~andy/linux/commitdiff
PCI/ACPI: Use acpi_driver_data() rather than searching acpi_pci_roots
authorTaku Izumi <izumi.taku@jp.fujitsu.com>
Tue, 18 Sep 2012 06:23:23 +0000 (15:23 +0900)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 24 Sep 2012 21:29:40 +0000 (15:29 -0600)
This patch changes the implementation of acpi_pci_find_root().

We can access acpi_pci_root without scanning acpi_pci_roots list.
If hostbridge hotplug is supported, acpi_pci_roots list will be
protected by mutex.  We should not access acpi_pci_roots list
if preventable to lessen deadlock risk.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/acpi/pci_root.c

index e1bdcc700cbbd6518b9d7a1082b621b0fb1c1658..13f9b5ba3354bf43fddb58d3eb12933418e7ccd5 100644 (file)
@@ -270,12 +270,15 @@ static acpi_status acpi_pci_osc_support(struct acpi_pci_root *root, u32 flags)
 struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle)
 {
        struct acpi_pci_root *root;
+       struct acpi_device *device;
 
-       list_for_each_entry(root, &acpi_pci_roots, node) {
-               if (root->device->handle == handle)
-                       return root;
-       }
-       return NULL;
+       if (acpi_bus_get_device(handle, &device) ||
+           acpi_match_device_ids(device, root_device_ids))
+               return NULL;
+
+       root = acpi_driver_data(device);
+
+       return root;
 }
 EXPORT_SYMBOL_GPL(acpi_pci_find_root);