mm: hugetlb: fix hugepage memory leak caused by wrong reserve count
[linux/fpc-iii.git] / arch / ia64 / include / asm / acenv.h
blob35ff13afbf345df260ecc30045f91ca1a77fce42
1 /*
2 * IA64 specific ACPICA environments and implementation
4 * Copyright (C) 2014, Intel Corporation
5 * Author: Lv Zheng <lv.zheng@intel.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #ifndef _ASM_IA64_ACENV_H
13 #define _ASM_IA64_ACENV_H
15 #include <asm/intrinsics.h>
17 #define COMPILER_DEPENDENT_INT64 long
18 #define COMPILER_DEPENDENT_UINT64 unsigned long
20 /* Asm macros */
22 static inline int
23 ia64_acpi_acquire_global_lock(unsigned int *lock)
25 unsigned int old, new, val;
26 do {
27 old = *lock;
28 new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
29 val = ia64_cmpxchg4_acq(lock, new, old);
30 } while (unlikely (val != old));
31 return (new < 3) ? -1 : 0;
34 static inline int
35 ia64_acpi_release_global_lock(unsigned int *lock)
37 unsigned int old, new, val;
38 do {
39 old = *lock;
40 new = old & ~0x3;
41 val = ia64_cmpxchg4_acq(lock, new, old);
42 } while (unlikely (val != old));
43 return old & 0x1;
46 #define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
47 ((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
49 #define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
50 ((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
52 #endif /* _ASM_IA64_ACENV_H */