Commit 2f977b36 authored by Bob Moore's avatar Bob Moore Committed by Len Brown

ACPICA: Fix fault if acpi_terminate is called twice

Fixes a problem with the mechanism that prevents problems if the
acpi_terminate interface is inadvertently called more than once
before the ACPICA code is re-initialized. ACPICA BZ 795.

http://acpica.org/bugzilla/show_bug.cgi?id=795Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLin Ming <ming.m.lin@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 53e9387b
...@@ -99,33 +99,19 @@ static void acpi_ut_terminate(void) ...@@ -99,33 +99,19 @@ static void acpi_ut_terminate(void)
* *
* FUNCTION: acpi_ut_subsystem_shutdown * FUNCTION: acpi_ut_subsystem_shutdown
* *
* PARAMETERS: none * PARAMETERS: None
* *
* RETURN: none * RETURN: None
* *
* DESCRIPTION: Shutdown the various subsystems. Don't delete the mutex * DESCRIPTION: Shutdown the various components. Do not delete the mutex
* objects here -- because the AML debugger may be still running. * objects here, because the AML debugger may be still running.
* *
******************************************************************************/ ******************************************************************************/
void acpi_ut_subsystem_shutdown(void) void acpi_ut_subsystem_shutdown(void)
{ {
ACPI_FUNCTION_TRACE(ut_subsystem_shutdown); ACPI_FUNCTION_TRACE(ut_subsystem_shutdown);
/* Just exit if subsystem is already shutdown */
if (acpi_gbl_shutdown) {
ACPI_ERROR((AE_INFO, "ACPI Subsystem is already terminated"));
return_VOID;
}
/* Subsystem appears active, go ahead and shut it down */
acpi_gbl_shutdown = TRUE;
acpi_gbl_startup_flags = 0;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n"));
#ifndef ACPI_ASL_COMPILER #ifndef ACPI_ASL_COMPILER
/* Close the acpi_event Handling */ /* Close the acpi_event Handling */
......
...@@ -318,7 +318,7 @@ ACPI_EXPORT_SYMBOL(acpi_initialize_objects) ...@@ -318,7 +318,7 @@ ACPI_EXPORT_SYMBOL(acpi_initialize_objects)
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. * DESCRIPTION: Shutdown the ACPICA subsystem and release all resources.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_terminate(void) acpi_status acpi_terminate(void)
...@@ -327,6 +327,19 @@ acpi_status acpi_terminate(void) ...@@ -327,6 +327,19 @@ acpi_status acpi_terminate(void)
ACPI_FUNCTION_TRACE(acpi_terminate); ACPI_FUNCTION_TRACE(acpi_terminate);
/* Just exit if subsystem is already shutdown */
if (acpi_gbl_shutdown) {
ACPI_ERROR((AE_INFO, "ACPI Subsystem is already terminated"));
return_ACPI_STATUS(AE_OK);
}
/* Subsystem appears active, go ahead and shut it down */
acpi_gbl_shutdown = TRUE;
acpi_gbl_startup_flags = 0;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n"));
/* Terminate the AML Debugger if present */ /* Terminate the AML Debugger if present */
ACPI_DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = TRUE); ACPI_DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = TRUE);
...@@ -353,6 +366,7 @@ acpi_status acpi_terminate(void) ...@@ -353,6 +366,7 @@ acpi_status acpi_terminate(void)
} }
ACPI_EXPORT_SYMBOL(acpi_terminate) ACPI_EXPORT_SYMBOL(acpi_terminate)
#ifndef ACPI_ASL_COMPILER #ifndef ACPI_ASL_COMPILER
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_FUTURE_USAGE
/******************************************************************************* /*******************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment