ACPI: ACPICA 20060623
[linux-2.6-block.git] / drivers / acpi / namespace / nsaccess.c
index 5e3f63a90fb4387e4fc2a4647d005833c6cec47b..c1c6c236df9affedc4ba07f0bbd161684b4053a6 100644 (file)
@@ -157,7 +157,7 @@ acpi_status acpi_ns_root_initialize(void)
 
 #if defined (ACPI_ASL_COMPILER)
 
-                               /* save the parameter count for the i_aSL compiler */
+                               /* Save the parameter count for the i_aSL compiler */
 
                                new_node->value = obj_desc->method.param_count;
 #else
@@ -196,33 +196,30 @@ acpi_status acpi_ns_root_initialize(void)
                                    (u8) (ACPI_TO_INTEGER(val) - 1);
 
                                if (ACPI_STRCMP(init_val->name, "_GL_") == 0) {
-                                       /*
-                                        * Create a counting semaphore for the
-                                        * global lock
-                                        */
+
+                                       /* Create a counting semaphore for the global lock */
+
                                        status =
                                            acpi_os_create_semaphore
                                            (ACPI_NO_UNIT_LIMIT, 1,
-                                            &obj_desc->mutex.semaphore);
+                                            &acpi_gbl_global_lock_semaphore);
                                        if (ACPI_FAILURE(status)) {
                                                acpi_ut_remove_reference
                                                    (obj_desc);
                                                goto unlock_and_exit;
                                        }
 
-                                       /*
-                                        * We just created the mutex for the
-                                        * global lock, save it
-                                        */
-                                       acpi_gbl_global_lock_semaphore =
-                                           obj_desc->mutex.semaphore;
+                                       /* Mark this mutex as very special */
+
+                                       obj_desc->mutex.os_mutex =
+                                           ACPI_GLOBAL_LOCK;
                                } else {
                                        /* Create a mutex */
 
-                                       status = acpi_os_create_semaphore(1, 1,
-                                                                         &obj_desc->
-                                                                         mutex.
-                                                                         semaphore);
+                                       status =
+                                           acpi_os_create_mutex(&obj_desc->
+                                                                mutex.
+                                                                os_mutex);
                                        if (ACPI_FAILURE(status)) {
                                                acpi_ut_remove_reference
                                                    (obj_desc);
@@ -259,10 +256,8 @@ acpi_status acpi_ns_root_initialize(void)
        /* Save a handle to "_GPE", it is always present */
 
        if (ACPI_SUCCESS(status)) {
-               status =
-                   acpi_ns_get_node_by_path("\\_GPE", NULL,
-                                            ACPI_NS_NO_UPSEARCH,
-                                            &acpi_gbl_fadt_gpe_device);
+               status = acpi_ns_get_node(NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH,
+                                         &acpi_gbl_fadt_gpe_device);
        }
 
        return_ACPI_STATUS(status);
@@ -311,8 +306,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
        acpi_object_type type_to_check_for;
        acpi_object_type this_search_type;
        u32 search_parent_flag = ACPI_NS_SEARCH_PARENT;
-       u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND |
-                                   ACPI_NS_SEARCH_PARENT);
+       u32 local_flags;
 
        ACPI_FUNCTION_TRACE(ns_lookup);
 
@@ -320,8 +314,9 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       acpi_gbl_ns_lookup_count++;
+       local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT);
        *return_node = ACPI_ENTRY_NOT_FOUND;
+       acpi_gbl_ns_lookup_count++;
 
        if (!acpi_gbl_root_node) {
                return_ACPI_STATUS(AE_NO_NAMESPACE);