Pull bugzilla-8066 into release branch

Len Brown bdf3aaf9 b2526300

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