Skip to content

Commit

Permalink
ACPICA: Add root node optimization to internal get namespace node fun…
Browse files Browse the repository at this point in the history
…ction.

Detect a request for the root node (a lone backslash) up front
before invoking a full namespace lookup.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Bob Moore authored and Rafael J. Wysocki committed Jan 10, 2013
1 parent 04a81dc commit f8c9bfe
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/acpi/acpica/nsutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,8 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node,

ACPI_FUNCTION_TRACE_PTR(ns_get_node, ACPI_CAST_PTR(char, pathname));

/* Simplest case is a null pathname */

if (!pathname) {
*return_node = prefix_node;
if (!prefix_node) {
Expand All @@ -679,6 +681,13 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
return_ACPI_STATUS(AE_OK);
}

/* Quick check for a reference to the root */

if (ACPI_IS_ROOT_PREFIX(pathname[0]) && (!pathname[1])) {
*return_node = acpi_gbl_root_node;
return_ACPI_STATUS(AE_OK);
}

/* Convert path to internal representation */

status = acpi_ns_internalize_name(pathname, &internal_path);
Expand Down

0 comments on commit f8c9bfe

Please sign in to comment.