ACPI: pci_root: use driver data rather than list lookup
authorBjorn Helgaas <bjorn.helgaas@hp.com>
Thu, 18 Jun 2009 20:46:57 +0000 (14:46 -0600)
committerLen Brown <len.brown@intel.com>
Sat, 20 Jun 2009 04:01:53 +0000 (00:01 -0400)
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>
drivers/acpi/pci_root.c

index 0d69c0348c58b0b272689013779b59462110ff2f..7984e00540fa0ec23dd900f96da3170d7ed5498e 100644 (file)
@@ -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;
 }