Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7841
b: refs/heads/master
c: a94f188
h: refs/heads/master
i:
  7839: 81ae656
v: v3
  • Loading branch information
Len Brown committed Sep 3, 2005
1 parent c2c3f33 commit 4a15bea
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 36 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8813dfbfc56b3f7c369b3115c2f70bcacd77ec51
refs/heads/master: a94f18810f52d3a6de0a09bee0c7258b62eca262
52 changes: 26 additions & 26 deletions trunk/drivers/acpi/dispatcher/dsmethod.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -480,15 +479,15 @@ 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
* tree if requested.
*
******************************************************************************/

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;
Expand All @@ -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 */
Expand All @@ -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 */
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
}
21 changes: 15 additions & 6 deletions trunk/drivers/acpi/parser/psparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
{
acpi_status status;
acpi_status terminate_status;
struct acpi_thread_state *thread;
struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list;
struct acpi_walk_state *previous_walk_state;
Expand Down Expand Up @@ -507,9 +508,6 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
walk_state->method_node, NULL,
status);

/* Make sure that failed method will be cleaned as if it was executed */
walk_state->parse_flags |= ACPI_PARSE_EXECUTE;

/* Check for possible multi-thread reentrancy problem */

if ((status == AE_ALREADY_EXISTS) &&
Expand All @@ -526,6 +524,14 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
}
}

if (walk_state->method_desc) {
/* Decrement the thread count on the method parse tree */

if (walk_state->method_desc->method.thread_count) {
walk_state->method_desc->method.thread_count--;
}
}

/* We are done with this walk, move on to the parent if any */

walk_state = acpi_ds_pop_walk_state(thread);
Expand All @@ -540,10 +546,13 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
*/
if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
ACPI_PARSE_EXECUTE) {
if (walk_state->method_desc) {
walk_state->method_desc->method.thread_count--;
terminate_status =
acpi_ds_terminate_control_method(walk_state);
if (ACPI_FAILURE(terminate_status)) {
ACPI_REPORT_ERROR(("Could not terminate control method properly\n"));

/* Ignore error and continue */
}
acpi_ds_terminate_control_method (walk_state);
}

/* Delete this walk state and all linked control states */
Expand Down
13 changes: 13 additions & 0 deletions trunk/drivers/acpi/parser/psxface.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
return_ACPI_STATUS(status);
}

/*
* Get a new owner_id for objects created by this method. Namespace
* objects (such as Operation Regions) can be created during the
* first pass parse.
*/
status = acpi_ut_allocate_owner_id(&info->obj_desc->method.owner_id);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}

/*
* The caller "owns" the parameters, so give each one an extra
* reference
Expand Down Expand Up @@ -129,6 +139,9 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
status = acpi_ps_execute_pass(info);

cleanup:
if (info->obj_desc->method.owner_id) {
acpi_ut_release_owner_id(&info->obj_desc->method.owner_id);
}

/* Take away the extra reference that we gave the parameters above */

Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/acpi/utilities/utmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)

ACPI_FUNCTION_TRACE("ut_allocate_owner_id");

WARN_ON(*owner_id);

/* Mutex for the global ID mask */

status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/acpi/acdispat.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ acpi_status
acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
union acpi_operand_object *return_desc);

void
acpi_status
acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state);

acpi_status
Expand Down

0 comments on commit 4a15bea

Please sign in to comment.