patch-2.4.26 linux-2.4.26/drivers/acpi/parser/psparse.c
Next file: linux-2.4.26/drivers/acpi/parser/psscope.c
Previous file: linux-2.4.26/drivers/acpi/parser/psargs.c
Back to the patch index
Back to the overall index
- Lines: 86
- Date:
2004-04-14 06:05:29.000000000 -0700
- Orig file:
linux-2.4.25/drivers/acpi/parser/psparse.c
- Orig date:
2004-02-18 05:36:31.000000000 -0800
diff -urN linux-2.4.25/drivers/acpi/parser/psparse.c linux-2.4.26/drivers/acpi/parser/psparse.c
@@ -426,7 +426,7 @@
acpi_status status = AE_OK;
union acpi_parse_object *op = NULL; /* current op */
union acpi_parse_object *arg = NULL;
- union acpi_parse_object pre_op;
+ union acpi_parse_object *pre_op = NULL;
struct acpi_parse_state *parser_state;
u8 *aml_op_start = NULL;
@@ -547,8 +547,17 @@
/* Create Op structure and append to parent's argument list */
if (walk_state->op_info->flags & AML_NAMED) {
- pre_op.common.value.arg = NULL;
- pre_op.common.aml_opcode = walk_state->opcode;
+ /* Allocate a new pre_op if necessary */
+
+ if (!pre_op) {
+ pre_op = acpi_ps_alloc_op (walk_state->opcode);
+ if (!pre_op) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+ }
+
+ pre_op->common.value.arg = NULL;
+ pre_op->common.aml_opcode = walk_state->opcode;
/*
* Get and append arguments until we find the node that contains
@@ -562,7 +571,7 @@
goto close_this_op;
}
- acpi_ps_append_arg (&pre_op, arg);
+ acpi_ps_append_arg (pre_op, arg);
INCREMENT_ARG_LIST (walk_state->arg_types);
}
@@ -603,7 +612,7 @@
goto close_this_op;
}
- acpi_ps_append_arg (op, pre_op.common.value.arg);
+ acpi_ps_append_arg (op, pre_op->common.value.arg);
acpi_gbl_depth++;
if (op->common.aml_opcode == AML_REGION_OP) {
@@ -854,6 +863,10 @@
acpi_ps_complete_this_op (walk_state, op);
op = NULL;
+ if (pre_op) {
+ acpi_ps_free_op (pre_op);
+ pre_op = NULL;
+ }
switch (status) {
case AE_OK:
@@ -1118,6 +1131,27 @@
else if (status != AE_OK) {
ACPI_REPORT_METHOD_ERROR ("Method execution failed",
walk_state->method_node, NULL, status);
+
+ /* Check for possible multi-thread reentrancy problem */
+
+ if ((status == AE_ALREADY_EXISTS) &&
+ (!walk_state->method_desc->method.semaphore)) {
+ /*
+ * This method is marked not_serialized, but it tried to create a named
+ * object, causing the second thread entrance to fail. We will workaround
+ * this by marking the method permanently as Serialized.
+ */
+ walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED;
+ walk_state->method_desc->method.concurrency = 1;
+ }
+ }
+
+ 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 */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)