diff options
Diffstat (limited to 'drivers/acpi/tables/tbinstal.c')
-rw-r--r-- | drivers/acpi/tables/tbinstal.c | 97 |
1 files changed, 55 insertions, 42 deletions
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 56e211ecf..b3926a0e3 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbinstal - ACPI table installation and removal - * $Revision: 29 $ + * $Revision: 34 $ * *****************************************************************************/ @@ -307,7 +307,7 @@ acpi_tb_delete_acpi_tables (void) * Memory can either be mapped or allocated */ - for (type = 0; type < ACPI_TABLE_MAX; type++) { + for (type = 0; type < NUM_ACPI_TABLES; type++) { acpi_tb_delete_acpi_table (type); } @@ -352,35 +352,24 @@ acpi_tb_delete_acpi_table ( acpi_gbl_RSDP = NULL; break; - case ACPI_TABLE_APIC: - acpi_gbl_APIC = NULL; - break; - case ACPI_TABLE_DSDT: acpi_gbl_DSDT = NULL; break; - case ACPI_TABLE_FACP: - acpi_gbl_FACP = NULL; + case ACPI_TABLE_FADT: + acpi_gbl_FADT = NULL; break; case ACPI_TABLE_FACS: acpi_gbl_FACS = NULL; break; - case ACPI_TABLE_PSDT: - break; - - case ACPI_TABLE_RSDT: - acpi_gbl_RSDT = NULL; + case ACPI_TABLE_XSDT: + acpi_gbl_XSDT = NULL; break; case ACPI_TABLE_SSDT: - break; - - case ACPI_TABLE_SBST: - acpi_gbl_SBST = NULL; - + case ACPI_TABLE_PSDT: default: break; } @@ -424,7 +413,7 @@ acpi_tb_free_acpi_tables_of_type ( */ for (i = 0; i < count; i++) { - table_desc = acpi_tb_delete_single_table (table_desc); + table_desc = acpi_tb_uninstall_table (table_desc); } return; @@ -439,37 +428,20 @@ acpi_tb_free_acpi_tables_of_type ( * * RETURN: None. * - * DESCRIPTION: Free the memory associated with an internal ACPI table that - * is either installed or has never been installed. - * Table mutex should be locked. + * DESCRIPTION: Low-level free for a single ACPI table. Handles cases where + * the table was allocated a buffer or was mapped. * ******************************************************************************/ -ACPI_TABLE_DESC * +void acpi_tb_delete_single_table ( ACPI_TABLE_DESC *table_desc) { - ACPI_TABLE_DESC *next_desc; - if (!table_desc) { - return (NULL); - } - - - /* Unlink the descriptor */ - - if (table_desc->prev) { - table_desc->prev->next = table_desc->next; - } - - if (table_desc->next) { - table_desc->next->prev = table_desc->prev; + return; } - - /* Free the memory allocated for the table itself */ - if (table_desc->pointer) { /* Valid table, determine type of memory allocation */ @@ -477,7 +449,6 @@ acpi_tb_delete_single_table ( { case ACPI_MEM_NOT_ALLOCATED: - break; @@ -493,10 +464,52 @@ acpi_tb_delete_single_table ( break; } } +} - /* Free the table descriptor (Don't delete the list head, tho) */ +/******************************************************************************* + * + * FUNCTION: Acpi_tb_uninstall_table + * + * PARAMETERS: Table_info - A table info struct + * + * RETURN: None. + * + * DESCRIPTION: Free the memory associated with an internal ACPI table that + * is either installed or has never been installed. + * Table mutex should be locked. + * + ******************************************************************************/ +ACPI_TABLE_DESC * +acpi_tb_uninstall_table ( + ACPI_TABLE_DESC *table_desc) +{ + ACPI_TABLE_DESC *next_desc; + + + if (!table_desc) { + return (NULL); + } + + + /* Unlink the descriptor */ + + if (table_desc->prev) { + table_desc->prev->next = table_desc->next; + } + + if (table_desc->next) { + table_desc->next->prev = table_desc->prev; + } + + + /* Free the memory allocated for the table itself */ + + acpi_tb_delete_single_table (table_desc); + + + /* Free the table descriptor (Don't delete the list head, tho) */ if ((table_desc->prev) == (table_desc->next)) { |