Skip to content

Commit

Permalink
ACPI: pci_root: use driver data rather than list lookup
Browse files Browse the repository at this point in the history
There's no need to search the list to find the acpi_pci_root
structure.  We saved it as device->driver_data when we added
the device.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Bjorn Helgaas authored and Len Brown committed Jun 20, 2009
1 parent f5eebbe commit caf420c
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions drivers/acpi/pci_root.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,30 +497,17 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)

static int acpi_pci_root_start(struct acpi_device *device)
{
struct acpi_pci_root *root;

struct acpi_pci_root *root = acpi_driver_data(device);

list_for_each_entry(root, &acpi_pci_roots, node) {
if (root->device == device) {
pci_bus_add_devices(root->bus);
return 0;
}
}
return -ENODEV;
pci_bus_add_devices(root->bus);
return 0;
}

static int acpi_pci_root_remove(struct acpi_device *device, int type)
{
struct acpi_pci_root *root = NULL;


if (!device || !acpi_driver_data(device))
return -EINVAL;

root = acpi_driver_data(device);
struct acpi_pci_root *root = acpi_driver_data(device);

kfree(root);

return 0;
}

Expand Down

0 comments on commit caf420c

Please sign in to comment.