ACPICA: _OSI Support: handle any errors from acpi_os_acquire_mutex()
Check for any errors. Handles possible timeout case if ACPI_WAIT_FOREVER is changed to be less than "forever". Jung-uk Kim. Signed-off-by: Jung-uk Kim <jkim@FreeBSD.org> 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>
This commit is contained in:
parent
c34c82bc96
commit
388a990207
@ -421,7 +421,7 @@ acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length);
|
||||
*/
|
||||
acpi_status acpi_ut_initialize_interfaces(void);
|
||||
|
||||
void acpi_ut_interface_terminate(void);
|
||||
acpi_status acpi_ut_interface_terminate(void);
|
||||
|
||||
acpi_status acpi_ut_install_interface(acpi_string interface_name);
|
||||
|
||||
|
@ -108,9 +108,14 @@ static struct acpi_interface_info acpi_default_supported_interfaces[] = {
|
||||
|
||||
acpi_status acpi_ut_initialize_interfaces(void)
|
||||
{
|
||||
acpi_status status;
|
||||
u32 i;
|
||||
|
||||
(void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
|
||||
status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
|
||||
acpi_gbl_supported_interfaces = acpi_default_supported_interfaces;
|
||||
|
||||
/* Link the static list of supported interfaces */
|
||||
@ -132,20 +137,24 @@ acpi_status acpi_ut_initialize_interfaces(void)
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Delete all interfaces in the global list. Sets
|
||||
* acpi_gbl_supported_interfaces to NULL.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void acpi_ut_interface_terminate(void)
|
||||
acpi_status acpi_ut_interface_terminate(void)
|
||||
{
|
||||
acpi_status status;
|
||||
struct acpi_interface_info *next_interface;
|
||||
|
||||
(void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
|
||||
next_interface = acpi_gbl_supported_interfaces;
|
||||
status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
|
||||
next_interface = acpi_gbl_supported_interfaces;
|
||||
while (next_interface) {
|
||||
acpi_gbl_supported_interfaces = next_interface->next;
|
||||
|
||||
@ -160,6 +169,7 @@ void acpi_ut_interface_terminate(void)
|
||||
}
|
||||
|
||||
acpi_os_release_mutex(acpi_gbl_osi_mutex);
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -315,6 +325,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state * walk_state)
|
||||
union acpi_operand_object *return_desc;
|
||||
struct acpi_interface_info *interface_info;
|
||||
acpi_interface_handler interface_handler;
|
||||
acpi_status status;
|
||||
u32 return_value;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ut_osi_implementation);
|
||||
@ -336,7 +347,10 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state * walk_state)
|
||||
/* Default return value is 0, NOT SUPPORTED */
|
||||
|
||||
return_value = 0;
|
||||
(void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
|
||||
status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
|
||||
/* Lookup the interface in the global _OSI list */
|
||||
|
||||
|
@ -287,7 +287,10 @@ acpi_status acpi_install_interface(acpi_string interface_name)
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
(void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
|
||||
status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
|
||||
/* Check if the interface name is already in the global list */
|
||||
|
||||
@ -336,7 +339,10 @@ acpi_status acpi_remove_interface(acpi_string interface_name)
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
(void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
|
||||
status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
|
||||
status = acpi_ut_remove_interface(interface_name);
|
||||
|
||||
@ -362,9 +368,12 @@ ACPI_EXPORT_SYMBOL(acpi_remove_interface)
|
||||
****************************************************************************/
|
||||
acpi_status acpi_install_interface_handler(acpi_interface_handler handler)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
acpi_status status;
|
||||
|
||||
(void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
|
||||
status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
|
||||
if (handler && acpi_gbl_interface_handler) {
|
||||
status = AE_ALREADY_EXISTS;
|
||||
|
Loading…
Reference in New Issue
Block a user