]> err.no Git - linux-2.6/blobdiff - drivers/acpi/dispatcher/dsmethod.c
[ACPI] revert owner-id-3.patch
[linux-2.6] / drivers / acpi / dispatcher / dsmethod.c
index 8b67a918341ef62aec8dc72bc64da7b9ac00d9e1..77fcfc3070dbfa14048dd27fdb3af21198d18bea 100644 (file)
@@ -235,16 +235,6 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
                    acpi_ex_system_wait_semaphore(obj_desc->method.semaphore,
                                                  ACPI_WAIT_FOREVER);
        }
-       /*
-        * allocate owner id for this method
-        */
-       if (!obj_desc->method.thread_count) {
-               status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
-               }
-       }
 
        /*
         * Increment the method parse tree thread count since it has been
@@ -299,6 +289,11 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
                return_ACPI_STATUS(AE_NULL_OBJECT);
        }
 
+       status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
        /* Init for new method, wait on concurrency semaphore */
 
        status = acpi_ds_begin_method_execution(method_node, obj_desc,
@@ -385,18 +380,22 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
 
        if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) {
                status = obj_desc->method.implementation(next_walk_state);
+               return_ACPI_STATUS(status);
        }
-       goto end;
 
-cleanup:
-       /* Decrement the thread count on the method parse tree */
+       return_ACPI_STATUS(AE_OK);
+
+       /* On error, we must delete the new walk state */
+
+      cleanup:
+       acpi_ut_release_owner_id(&obj_desc->method.owner_id);
        if (next_walk_state && (next_walk_state->method_desc)) {
+               /* Decrement the thread count on the method parse tree */
+
                next_walk_state->method_desc->method.thread_count--;
        }
-       /* On error, we must delete the new walk state */
-       acpi_ds_terminate_control_method (next_walk_state);
-       acpi_ds_delete_walk_state (next_walk_state);
-end:
+       (void)acpi_ds_terminate_control_method(next_walk_state);
+       acpi_ds_delete_walk_state(next_walk_state);
        return_ACPI_STATUS(status);
 }
 
@@ -480,7 +479,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
  *
  * PARAMETERS:  walk_state          - State of the method
  *
- * RETURN:      None
+ * RETURN:      Status
  *
  * DESCRIPTION: Terminate a control method.  Delete everything that the method
  *              created, delete all locals and arguments, and delete the parse
@@ -488,7 +487,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
  *
  ******************************************************************************/
 
-void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
+acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
 {
        union acpi_operand_object *obj_desc;
        struct acpi_namespace_node *method_node;
@@ -497,14 +496,14 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
        ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state);
 
        if (!walk_state) {
-               return_VOID;
+               return (AE_BAD_PARAMETER);
        }
 
        /* The current method object was saved in the walk state */
 
        obj_desc = walk_state->method_desc;
        if (!obj_desc) {
-               return_VOID;
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Delete all arguments and locals */
@@ -518,7 +517,7 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
         */
        status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER);
        if (ACPI_FAILURE(status)) {
-               return_VOID;
+               return_ACPI_STATUS(status);
        }
 
        /* Signal completion of the execution of this method if necessary */
@@ -575,7 +574,7 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
                 */
                status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
                if (ACPI_FAILURE(status)) {
-                       goto cleanup;
+                       return_ACPI_STATUS(status);
                }
 
                if (method_node->child) {
@@ -593,9 +592,10 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
                                         owner_id);
 
                if (ACPI_FAILURE(status)) {
-                       goto cleanup;
+                       return_ACPI_STATUS(status);
                }
        }
-cleanup:
-       acpi_ut_release_mutex (ACPI_MTX_PARSER);
+
+       status = acpi_ut_release_mutex(ACPI_MTX_PARSER);
+       return_ACPI_STATUS(status);
 }