aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLin Ming <ming.m.lin@intel.com>2010-01-20 20:15:20 -0500
committerLen Brown <len.brown@intel.com>2010-01-22 12:30:05 -0500
commit5f8902acf87aa206ee4b3f633104456d82747ca6 (patch)
tree8460d04dee94605cdc448f545045598e94b0ed2a
parenta8357b0c95484b46944728712f8810d3b37bf588 (diff)
ACPICA: AcpiGetDevices: Eliminate unnecessary _STA calls
In the case where a specific _HID is requested, do not run _STA until a _HID match is found. This eliminates potentially dozens of _STA calls during a search for a particular device/HID. Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/acpica/nsxfeval.c52
1 files changed, 33 insertions, 19 deletions
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index c5a5357c69e6..ebef8a7fd707 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -562,25 +562,20 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
562 return (AE_BAD_PARAMETER); 562 return (AE_BAD_PARAMETER);
563 } 563 }
564 564
565 /* Run _STA to determine if device is present */ 565 /*
566 566 * First, filter based on the device HID and CID.
567 status = acpi_ut_execute_STA(node, &flags); 567 *
568 if (ACPI_FAILURE(status)) { 568 * 01/2010: For this case where a specific HID is requested, we don't
569 return (AE_CTRL_DEPTH); 569 * want to run _STA until we have an actual HID match. Thus, we will
570 } 570 * not unnecessarily execute _STA on devices for which the caller
571 571 * doesn't care about. Previously, _STA was executed unconditionally
572 if (!(flags & ACPI_STA_DEVICE_PRESENT) && 572 * on all devices found here.
573 !(flags & ACPI_STA_DEVICE_FUNCTIONING)) { 573 *
574 /* 574 * A side-effect of this change is that now we will continue to search
575 * Don't examine the children of the device only when the 575 * for a matching HID even under device trees where the parent device
576 * device is neither present nor functional. See ACPI spec, 576 * would have returned a _STA that indicates it is not present or
577 * description of _STA for more information. 577 * not functioning (thus aborting the search on that branch).
578 */ 578 */
579 return (AE_CTRL_DEPTH);
580 }
581
582 /* Filter based on device HID & CID */
583
584 if (info->hid != NULL) { 579 if (info->hid != NULL) {
585 status = acpi_ut_execute_HID(node, &hid); 580 status = acpi_ut_execute_HID(node, &hid);
586 if (status == AE_NOT_FOUND) { 581 if (status == AE_NOT_FOUND) {
@@ -620,6 +615,25 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
620 } 615 }
621 } 616 }
622 617
618 /* Run _STA to determine if device is present */
619
620 status = acpi_ut_execute_STA(node, &flags);
621 if (ACPI_FAILURE(status)) {
622 return (AE_CTRL_DEPTH);
623 }
624
625 if (!(flags & ACPI_STA_DEVICE_PRESENT) &&
626 !(flags & ACPI_STA_DEVICE_FUNCTIONING)) {
627 /*
628 * Don't examine the children of the device only when the
629 * device is neither present nor functional. See ACPI spec,
630 * description of _STA for more information.
631 */
632 return (AE_CTRL_DEPTH);
633 }
634
635 /* We have a valid device, invoke the user function */
636
623 status = info->user_function(obj_handle, nesting_level, info->context, 637 status = info->user_function(obj_handle, nesting_level, info->context,
624 return_value); 638 return_value);
625 return (status); 639 return (status);