diff options
Diffstat (limited to 'drivers/acpi/acpica/utmutex.c')
| -rw-r--r-- | drivers/acpi/acpica/utmutex.c | 53 | 
1 files changed, 33 insertions, 20 deletions
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c index d9efa495b43..82717fff9ff 100644 --- a/drivers/acpi/acpica/utmutex.c +++ b/drivers/acpi/acpica/utmutex.c @@ -5,7 +5,7 @@   ******************************************************************************/  /* - * Copyright (C) 2000 - 2010, Intel Corp. + * Copyright (C) 2000 - 2014, Intel Corp.   * All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -81,12 +81,25 @@ acpi_status acpi_ut_mutex_initialize(void)  		}  	} -	/* Create the spinlocks for use at interrupt level */ +	/* Create the spinlocks for use at interrupt level or for speed */ -	spin_lock_init(acpi_gbl_gpe_lock); -	spin_lock_init(acpi_gbl_hardware_lock); +	status = acpi_os_create_lock (&acpi_gbl_gpe_lock); +	if (ACPI_FAILURE (status)) { +		return_ACPI_STATUS (status); +	} + +	status = acpi_os_create_lock (&acpi_gbl_hardware_lock); +	if (ACPI_FAILURE (status)) { +		return_ACPI_STATUS (status); +	} + +	status = acpi_os_create_lock(&acpi_gbl_reference_count_lock); +	if (ACPI_FAILURE(status)) { +		return_ACPI_STATUS(status); +	}  	/* Mutex for _OSI support */ +  	status = acpi_os_create_mutex(&acpi_gbl_osi_mutex);  	if (ACPI_FAILURE(status)) {  		return_ACPI_STATUS(status); @@ -129,6 +142,7 @@ void acpi_ut_mutex_terminate(void)  	acpi_os_delete_lock(acpi_gbl_gpe_lock);  	acpi_os_delete_lock(acpi_gbl_hardware_lock); +	acpi_os_delete_lock(acpi_gbl_reference_count_lock);  	/* Delete the reader/writer lock */ @@ -140,7 +154,7 @@ void acpi_ut_mutex_terminate(void)   *   * FUNCTION:    acpi_ut_create_mutex   * - * PARAMETERS:  mutex_iD        - ID of the mutex to be created + * PARAMETERS:  mutex_ID        - ID of the mutex to be created   *   * RETURN:      Status   * @@ -169,7 +183,7 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id)   *   * FUNCTION:    acpi_ut_delete_mutex   * - * PARAMETERS:  mutex_iD        - ID of the mutex to be deleted + * PARAMETERS:  mutex_ID        - ID of the mutex to be deleted   *   * RETURN:      Status   * @@ -186,13 +200,15 @@ static void acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)  	acpi_gbl_mutex_info[mutex_id].mutex = NULL;  	acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; + +	return_VOID;  }  /*******************************************************************************   *   * FUNCTION:    acpi_ut_acquire_mutex   * - * PARAMETERS:  mutex_iD        - ID of the mutex to be acquired + * PARAMETERS:  mutex_ID        - ID of the mutex to be acquired   *   * RETURN:      Status   * @@ -219,9 +235,9 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)  		/*  		 * Mutex debug code, for internal debugging only.  		 * -		 * Deadlock prevention.  Check if this thread owns any mutexes of value -		 * greater than or equal to this one.  If so, the thread has violated -		 * the mutex ordering rule.  This indicates a coding error somewhere in +		 * Deadlock prevention. Check if this thread owns any mutexes of value +		 * greater than or equal to this one. If so, the thread has violated +		 * the mutex ordering rule. This indicates a coding error somewhere in  		 * the ACPI subsystem code.  		 */  		for (i = mutex_id; i < ACPI_NUM_MUTEX; i++) { @@ -276,7 +292,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)   *   * FUNCTION:    acpi_ut_release_mutex   * - * PARAMETERS:  mutex_iD        - ID of the mutex to be released + * PARAMETERS:  mutex_ID        - ID of the mutex to be released   *   * RETURN:      Status   * @@ -286,14 +302,10 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)  acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)  { -	acpi_thread_id this_thread_id; -  	ACPI_FUNCTION_NAME(ut_release_mutex); -	this_thread_id = acpi_os_get_thread_id(); -  	ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %u releasing Mutex [%s]\n", -			  (u32)this_thread_id, +			  (u32)acpi_os_get_thread_id(),  			  acpi_ut_get_mutex_name(mutex_id)));  	if (mutex_id > ACPI_MAX_MUTEX) { @@ -316,13 +328,14 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)  		/*  		 * Mutex debug code, for internal debugging only.  		 * -		 * Deadlock prevention.  Check if this thread owns any mutexes of value -		 * greater than this one.  If so, the thread has violated the mutex -		 * ordering rule.  This indicates a coding error somewhere in +		 * Deadlock prevention. Check if this thread owns any mutexes of value +		 * greater than this one. If so, the thread has violated the mutex +		 * ordering rule. This indicates a coding error somewhere in  		 * the ACPI subsystem code.  		 */  		for (i = mutex_id; i < ACPI_NUM_MUTEX; i++) { -			if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { +			if (acpi_gbl_mutex_info[i].thread_id == +			    acpi_os_get_thread_id()) {  				if (i == mutex_id) {  					continue;  				}  | 
