aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2013-11-20 23:20:06 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-11-21 07:47:04 -0500
commit3f69fe153133f781d546f0c53f7dd3889275c90d (patch)
treef2250c42949b7202f27615b64c5660ce410f26db /drivers/acpi/acpica
parent794ba09bf30054c81832e61b49a64a56c95c5a9f (diff)
ACPICA: Add support to delete all objects attached to the root namespace node.
This fix deletes any and all objects that have been attached to the root node (via acpi_attach_data). Reported by Tomasz Nowicki. ACPICA BZ 1026. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r--drivers/acpi/acpica/nsalloc.c6
-rw-r--r--drivers/acpi/acpica/nsutils.c18
2 files changed, 16 insertions, 8 deletions
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c
index bc3f598257a2..fd1ff54cda19 100644
--- a/drivers/acpi/acpica/nsalloc.c
+++ b/drivers/acpi/acpica/nsalloc.c
@@ -134,6 +134,12 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
134 obj_desc = next_desc; 134 obj_desc = next_desc;
135 } 135 }
136 136
137 /* Special case for the statically allocated root node */
138
139 if (node == acpi_gbl_root_node) {
140 return;
141 }
142
137 /* Now we can delete the node */ 143 /* Now we can delete the node */
138 144
139 (void)acpi_os_release_object(acpi_gbl_namespace_cache, node); 145 (void)acpi_os_release_object(acpi_gbl_namespace_cache, node);
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
index cc2fea94c5f0..4a0665b6bcc1 100644
--- a/drivers/acpi/acpica/nsutils.c
+++ b/drivers/acpi/acpica/nsutils.c
@@ -593,24 +593,26 @@ struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle)
593 593
594void acpi_ns_terminate(void) 594void acpi_ns_terminate(void)
595{ 595{
596 union acpi_operand_object *obj_desc; 596 acpi_status status;
597 597
598 ACPI_FUNCTION_TRACE(ns_terminate); 598 ACPI_FUNCTION_TRACE(ns_terminate);
599 599
600 /* 600 /*
601 * 1) Free the entire namespace -- all nodes and objects 601 * Free the entire namespace -- all nodes and all objects
602 * 602 * attached to the nodes
603 * Delete all object descriptors attached to namepsace nodes
604 */ 603 */
605 acpi_ns_delete_namespace_subtree(acpi_gbl_root_node); 604 acpi_ns_delete_namespace_subtree(acpi_gbl_root_node);
606 605
607 /* Detach any objects attached to the root */ 606 /* Delete any objects attached to the root node */
608 607
609 obj_desc = acpi_ns_get_attached_object(acpi_gbl_root_node); 608 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
610 if (obj_desc) { 609 if (ACPI_FAILURE(status)) {
611 acpi_ns_detach_object(acpi_gbl_root_node); 610 return_VOID;
612 } 611 }
613 612
613 acpi_ns_delete_node(acpi_gbl_root_node);
614 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
615
614 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace freed\n")); 616 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace freed\n"));
615 return_VOID; 617 return_VOID;
616} 618}