From 64408be77270cc16f75d0ae75302e6e9e7336568 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Thu, 7 Dec 2023 16:08:44 -0500 Subject: [PATCH] acpi: Fix copy/paste error in GlobalLock functions. Should fix #18701. --- src/add-ons/kernel/bus_managers/acpi/ACPICAHaiku.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/bus_managers/acpi/ACPICAHaiku.cpp b/src/add-ons/kernel/bus_managers/acpi/ACPICAHaiku.cpp index cf300b8fd2..1587f6bee3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/ACPICAHaiku.cpp +++ b/src/add-ons/kernel/bus_managers/acpi/ACPICAHaiku.cpp @@ -1238,7 +1238,8 @@ AcpiOsAcquireGlobalLock(volatile uint32_t *lock) if ((oldValue & ACPI_GLOCK_OWNED) != 0) newValue |= ACPI_GLOCK_PENDING; } while (atomic_test_and_set((int32*)lock, newValue, oldValue) != (int32)oldValue); - return (newValue & ACPI_GLOCK_PENDING) != 0; + + return (newValue & ACPI_GLOCK_PENDING) == 0; } @@ -1259,6 +1260,7 @@ AcpiOsReleaseGlobalLock(volatile uint32_t *lock) oldValue = *lock; newValue = oldValue & ~(ACPI_GLOCK_PENDING | ACPI_GLOCK_OWNED); } while (atomic_test_and_set((int32*)lock, newValue, oldValue) != (int32)oldValue); + return (oldValue & ACPI_GLOCK_PENDING) != 0; }