summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/nseval.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 19:57:06 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 19:57:06 -0800
commit3067e02f8f3ae2f3f02ba76400d03b8bcb4942b0 (patch)
tree761e19d279b27a03714a6673811e76e0b1cf2081 /drivers/acpi/acpica/nseval.c
parentf71eaf68406cfee91b6a96bcdf7ce33dc78829c5 (diff)
parentb00eb796f1b67c46036b5490e83b31741f1eebaf (diff)
downloadop-kernel-dev-3067e02f8f3ae2f3f02ba76400d03b8bcb4942b0.zip
op-kernel-dev-3067e02f8f3ae2f3f02ba76400d03b8bcb4942b0.tar.gz
Merge branch 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: ACPICA: Update version to 20091112. ACPICA: Add additional module-level code support ACPICA: Deploy new create integer interface where appropriate ACPICA: New internal utility function to create Integer objects ACPICA: Add repair for predefined methods that must return sorted lists ACPICA: Fix possible fault if return Package objects contain NULL elements ACPICA: Add post-order callback to acpi_walk_namespace ACPICA: Change package length error message to an info message ACPICA: Reduce severity of predefined repair messages, Warning to Info ACPICA: Update version to 20091013 ACPICA: Fix possible memory leak for Scope ASL operator ACPICA: Remove possibility of executing _REG methods twice ACPICA: Add repair for bad _MAT buffers ACPICA: Add repair for bad _BIF/_BIX packages
Diffstat (limited to 'drivers/acpi/acpica/nseval.c')
-rw-r--r--drivers/acpi/acpica/nseval.c50
1 files changed, 35 insertions, 15 deletions
diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c
index 846d113..f771e97 100644
--- a/drivers/acpi/acpica/nseval.c
+++ b/drivers/acpi/acpica/nseval.c
@@ -366,33 +366,49 @@ static void
acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
struct acpi_evaluate_info *info)
{
- union acpi_operand_object *root_obj;
+ union acpi_operand_object *parent_obj;
+ struct acpi_namespace_node *parent_node;
+ acpi_object_type type;
acpi_status status;
ACPI_FUNCTION_TRACE(ns_exec_module_code);
+ /*
+ * Get the parent node. We cheat by using the next_object field
+ * of the method object descriptor.
+ */
+ parent_node = ACPI_CAST_PTR(struct acpi_namespace_node,
+ method_obj->method.next_object);
+ type = acpi_ns_get_type(parent_node);
+
+ /* Must clear next_object (acpi_ns_attach_object needs the field) */
+
+ method_obj->method.next_object = NULL;
+
/* Initialize the evaluation information block */
ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info));
- info->prefix_node = acpi_gbl_root_node;
+ info->prefix_node = parent_node;
/*
- * Get the currently attached root object. Add a reference, because the
+ * Get the currently attached parent object. Add a reference, because the
* ref count will be decreased when the method object is installed to
- * the root node.
+ * the parent node.
*/
- root_obj = acpi_ns_get_attached_object(acpi_gbl_root_node);
- acpi_ut_add_reference(root_obj);
+ parent_obj = acpi_ns_get_attached_object(parent_node);
+ if (parent_obj) {
+ acpi_ut_add_reference(parent_obj);
+ }
- /* Install the method (module-level code) in the root node */
+ /* Install the method (module-level code) in the parent node */
- status = acpi_ns_attach_object(acpi_gbl_root_node, method_obj,
+ status = acpi_ns_attach_object(parent_node, method_obj,
ACPI_TYPE_METHOD);
if (ACPI_FAILURE(status)) {
goto exit;
}
- /* Execute the root node as a control method */
+ /* Execute the parent node as a control method */
status = acpi_ns_evaluate(info);
@@ -401,15 +417,19 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
/* Detach the temporary method object */
- acpi_ns_detach_object(acpi_gbl_root_node);
+ acpi_ns_detach_object(parent_node);
- /* Restore the original root object */
+ /* Restore the original parent object */
- status =
- acpi_ns_attach_object(acpi_gbl_root_node, root_obj,
- ACPI_TYPE_DEVICE);
+ if (parent_obj) {
+ status = acpi_ns_attach_object(parent_node, parent_obj, type);
+ } else {
+ parent_node->type = (u8)type;
+ }
exit:
- acpi_ut_remove_reference(root_obj);
+ if (parent_obj) {
+ acpi_ut_remove_reference(parent_obj);
+ }
return_VOID;
}
OpenPOWER on IntegriCloud