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; }