ACPICA: Namespace: Add acpi_ns_get_node_unlocked()
authorLv Zheng <lv.zheng@intel.com>
Wed, 7 Sep 2016 06:07:02 +0000 (14:07 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 10 Sep 2016 00:43:02 +0000 (02:43 +0200)
ACPICA commit 3ef1a1bf5612fe1a629424c09eaaeb6f299d313c

Add acpi_ns_get_node_unlocked() to be used when ACPI_MTX_NAMESPACE is
locked. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/3ef1a1bf
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Greg White <gwhite@kupulau.com>
Tested-by: Dutch Guy <lucht_piloot@gmx.net>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/acnamesp.h
drivers/acpi/acpica/nsutils.c

index 829672a288bd607407656503225d6b16d129f542..bb7fca1c8ba307add15b588cd38a64084275d037 100644 (file)
@@ -298,6 +298,11 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle,
 u8
 acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
 
+acpi_status
+acpi_ns_get_node_unlocked(struct acpi_namespace_node *prefix_node,
+                         const char *external_pathname,
+                         u32 flags, struct acpi_namespace_node **out_node);
+
 acpi_status
 acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
                 const char *external_pathname,
index 784a30b76e0f42b23fa4d95e4df9474b341df72e..691814dfed313123b739bcb5a4a53e58d6d32ddc 100644 (file)
@@ -662,7 +662,7 @@ u32 acpi_ns_opens_scope(acpi_object_type type)
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ns_get_node
+ * FUNCTION:    acpi_ns_get_node_unlocked
  *
  * PARAMETERS:  *pathname   - Name to be found, in external (ASL) format. The
  *                            \ (backslash) and ^ (carat) prefixes, and the
@@ -678,20 +678,21 @@ u32 acpi_ns_opens_scope(acpi_object_type type)
  * DESCRIPTION: Look up a name relative to a given scope and return the
  *              corresponding Node. NOTE: Scope can be null.
  *
- * MUTEX:       Locks namespace
+ * MUTEX:       Doesn't locks namespace
  *
  ******************************************************************************/
 
 acpi_status
-acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
-                const char *pathname,
-                u32 flags, struct acpi_namespace_node **return_node)
+acpi_ns_get_node_unlocked(struct acpi_namespace_node *prefix_node,
+                         const char *pathname,
+                         u32 flags, struct acpi_namespace_node **return_node)
 {
        union acpi_generic_state scope_info;
        acpi_status status;
        char *internal_path;
 
-       ACPI_FUNCTION_TRACE_PTR(ns_get_node, ACPI_CAST_PTR(char, pathname));
+       ACPI_FUNCTION_TRACE_PTR(ns_get_node_unlocked,
+                               ACPI_CAST_PTR(char, pathname));
 
        /* Simplest case is a null pathname */
 
@@ -718,13 +719,6 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
                return_ACPI_STATUS(status);
        }
 
-       /* Must lock namespace during lookup */
-
-       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE(status)) {
-               goto cleanup;
-       }
-
        /* Setup lookup scope (search starting point) */
 
        scope_info.scope.node = prefix_node;
@@ -740,9 +734,49 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
                                  pathname, acpi_format_exception(status)));
        }
 
-       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
-
-cleanup:
        ACPI_FREE(internal_path);
        return_ACPI_STATUS(status);
 }
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_get_node
+ *
+ * PARAMETERS:  *pathname   - Name to be found, in external (ASL) format. The
+ *                            \ (backslash) and ^ (carat) prefixes, and the
+ *                            . (period) to separate segments are supported.
+ *              prefix_node  - Root of subtree to be searched, or NS_ALL for the
+ *                            root of the name space. If Name is fully
+ *                            qualified (first s8 is '\'), the passed value
+ *                            of Scope will not be accessed.
+ *              flags       - Used to indicate whether to perform upsearch or
+ *                            not.
+ *              return_node - Where the Node is returned
+ *
+ * DESCRIPTION: Look up a name relative to a given scope and return the
+ *              corresponding Node. NOTE: Scope can be null.
+ *
+ * MUTEX:       Locks namespace
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
+                const char *pathname,
+                u32 flags, struct acpi_namespace_node **return_node)
+{
+       acpi_status status;
+
+       ACPI_FUNCTION_TRACE_PTR(ns_get_node, ACPI_CAST_PTR(char, pathname));
+
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
+       status = acpi_ns_get_node_unlocked(prefix_node, pathname,
+                                          flags, return_node);
+
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       return_ACPI_STATUS(status);
+}