Skip to content

Commit 1699dbe

Browse files
committed
Merge tag 'x86_acpi_for_v6.4_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 ACPI update from Borislav Petkov: - Improve code generation in ACPI's global lock's acquisition function * tag 'x86_acpi_for_v6.4_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/ACPI/boot: Improve __acpi_acquire_global_lock
2 parents d346415 + 2276754 commit 1699dbe

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

arch/x86/kernel/acpi/boot.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,13 +1858,18 @@ early_param("acpi_sci", setup_acpi_sci);
18581858

18591859
int __acpi_acquire_global_lock(unsigned int *lock)
18601860
{
1861-
unsigned int old, new;
1861+
unsigned int old, new, val;
18621862

18631863
old = READ_ONCE(*lock);
18641864
do {
1865-
new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
1865+
val = (old >> 1) & 0x1;
1866+
new = (old & ~0x3) + 2 + val;
18661867
} while (!try_cmpxchg(lock, &old, new));
1867-
return ((new & 0x3) < 3) ? -1 : 0;
1868+
1869+
if (val)
1870+
return 0;
1871+
1872+
return -1;
18681873
}
18691874

18701875
int __acpi_release_global_lock(unsigned int *lock)

0 commit comments

Comments
 (0)