ACPI: optimize pci_rootbridge search
authorChen, Justin <justin.chen@hp.com>
Tue, 10 Oct 2006 21:07:00 +0000 (17:07 -0400)
committerLen Brown <len.brown@intel.com>
Fri, 27 Oct 2006 06:31:16 +0000 (02:31 -0400)
acpi_get_pci_rootbridge_handle() walks the ACPI name space
searching for seg, bus and the PCI_ROOT_HID_STRING --
returning the handle as soon as if find the match.

But the current codes always parses through the whole namespace because
the user_function find_pci_rootbridge() returns status=AE_OK when it finds the match.

Make the find_pci_rootbridge() return AE_CTRL_TERMINATE when it finds the match.
This reduces the ACPI namespace walk for acpi_get_pci_rootbridge_handle().

Signed-off-by: Justin Chen <justin.chen@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/glue.c

index 10f160dc75b1cb5370063bcf96a6c738745d028c..ba8fe83c6298cbd809ae89decc47817e965778d9 100644 (file)
@@ -189,8 +189,12 @@ find_pci_rootbridge(acpi_handle handle, u32 lvl, void *context, void **rv)
        bus = tmp;
 
        if (seg == find->seg && bus == find->bus)
+       {
                find->handle = handle;
-       status = AE_OK;
+               status = AE_CTRL_TERMINATE;
+       }
+       else
+               status = AE_OK;
       exit:
        kfree(buffer.pointer);
        return status;