Skip to content

Commit

Permalink
PCI/ACPI: Use acpi_driver_data() rather than searching acpi_pci_roots
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
  • Loading branch information
izumi777 authored and bjorn-helgaas committed Sep 24, 2012
1 parent 6507e6e commit cd4faf9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/acpi/pci_root.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit cd4faf9

Please sign in to comment.