Skip to contentSkip to conversation

ACPICA: Invoke table unload handler after removing namespace objects

PATCH New Rafael J. Wysocki 1 participant 1 message Oct 22, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPICA: Invoke table unload handler after removing namespace objects

From: Rafael J. Wysocki <[email protected]>

At the point where acpi_gbl_table_handler(ACPI_TABLE_EVENT_UNLOAD, ...) is called we don't really know what objects are going to be deleted as a result of the table unload, so it is difficult to do the cleanup from the handler in some cases (specifically, when some data items have been attached to the objects being deleted).

For this reason, call acpi_gbl_table_handler(ACPI_TABLE_EVENT_UNLOAD, ...) after acpi_tb_delete_namespace_by_owner() has run so that it can do the cleanup properly.

---
 drivers/acpi/acpica/tbxfload.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/acpi/acpica/tbxfload.c +9 -9
Index: linux-pm/drivers/acpi/acpica/tbxfload.c
===================================================================
@@ -352,15 +352,6 @@ acpi_status acpi_unload_parent_table(acp
 			break;
 		}
 
-		/* Invoke table handler if present */
-
-		if (acpi_gbl_table_handler) {
-			(void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_UNLOAD,
-						     acpi_gbl_root_table_list.
-						     tables[i].pointer,
-						     acpi_gbl_table_handler_context);
-		}
-
 		/*
 		 * Delete all namespace objects owned by this table. Note that
 		 * these objects can appear anywhere in the namespace by virtue
@@ -372,6 +363,15 @@ acpi_status acpi_unload_parent_table(acp
 			break;
 		}
 
+		/* Invoke table handler if present */
+
+		if (acpi_gbl_table_handler) {
+			(void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_UNLOAD,
+						     acpi_gbl_root_table_list.
+						     tables[i].pointer,
+						     acpi_gbl_table_handler_context);
+		}
+
 		status = acpi_tb_release_owner_id(i);
 		acpi_tb_set_table_loaded_flag(i, FALSE);
 		break;