summaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-06-18 22:46:57 +0200
committerLen Brown <len.brown@intel.com>2009-06-20 06:01:53 +0200
commitcaf420c68afe01acd7c458ce40b85b3db5330ff5 (patch)
tree28463c5028597e94ca6cae2af914468ff687a72d /drivers/acpi
parentACPI: pci_root: simplify acpi_pci_root_add() control flow (diff)
downloadlinux-caf420c68afe01acd7c458ce40b85b3db5330ff5.tar.xz
linux-caf420c68afe01acd7c458ce40b85b3db5330ff5.zip
ACPI: pci_root: use driver data rather than list lookup
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>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/pci_root.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 0d69c0348c58..7984e00540fa 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -497,30 +497,17 @@ end:
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;
}