Pull bugzilla-8066 into release branch

Len Brown bdf3aaf9 b2526300

+23 -2
+23 -2
drivers/acpi/events/evmisc.c
··· 423 * the global lock appear as a standard mutex on the OS side. 424 * 425 *****************************************************************************/ 426 427 acpi_status acpi_ev_acquire_global_lock(u16 timeout) 428 { ··· 437 * Only one thread can acquire the GL at a time, the global_lock_mutex 438 * enforces this. This interface releases the interpreter if we must wait. 439 */ 440 - status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, timeout); 441 if (ACPI_FAILURE(status)) { 442 return_ACPI_STATUS(status); 443 } 444 445 /* 446 * Make sure that a global lock actually exists. If not, just treat ··· 521 return_ACPI_STATUS(AE_NOT_ACQUIRED); 522 } 523 524 if (acpi_gbl_global_lock_present) { 525 526 /* Allow any thread to release the lock */ ··· 549 acpi_gbl_global_lock_acquired = FALSE; 550 551 /* Release the local GL mutex */ 552 - 553 acpi_os_release_mutex(acpi_gbl_global_lock_mutex); 554 return_ACPI_STATUS(status); 555 }
··· 423 * the global lock appear as a standard mutex on the OS side. 424 * 425 *****************************************************************************/ 426 + static acpi_thread_id acpi_ev_global_lock_thread_id; 427 + static int acpi_ev_global_lock_acquired; 428 429 acpi_status acpi_ev_acquire_global_lock(u16 timeout) 430 { ··· 435 * Only one thread can acquire the GL at a time, the global_lock_mutex 436 * enforces this. This interface releases the interpreter if we must wait. 437 */ 438 + status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, 0); 439 + if (status == AE_TIME) { 440 + if (acpi_ev_global_lock_thread_id == acpi_os_get_thread_id()) { 441 + acpi_ev_global_lock_acquired++; 442 + return AE_OK; 443 + } 444 + } 445 + 446 + if (ACPI_FAILURE(status)) { 447 + status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, timeout); 448 + } 449 if (ACPI_FAILURE(status)) { 450 return_ACPI_STATUS(status); 451 } 452 + 453 + acpi_ev_global_lock_thread_id = acpi_os_get_thread_id(); 454 + acpi_ev_global_lock_acquired++; 455 456 /* 457 * Make sure that a global lock actually exists. If not, just treat ··· 506 return_ACPI_STATUS(AE_NOT_ACQUIRED); 507 } 508 509 + acpi_ev_global_lock_acquired--; 510 + if (acpi_ev_global_lock_acquired > 0) { 511 + return AE_OK; 512 + } 513 + 514 if (acpi_gbl_global_lock_present) { 515 516 /* Allow any thread to release the lock */ ··· 529 acpi_gbl_global_lock_acquired = FALSE; 530 531 /* Release the local GL mutex */ 532 + acpi_ev_global_lock_thread_id = 0; 533 + acpi_ev_global_lock_acquired = 0; 534 acpi_os_release_mutex(acpi_gbl_global_lock_mutex); 535 return_ACPI_STATUS(status); 536 }