]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - include/linux/atomic.h
1 #ifndef _LINUX_ATOMIC_H
2 #define _LINUX_ATOMIC_H
3 #include <asm/atomic.h>
6 * atomic_inc_not_zero_hint - increment if not null
7 * @v: pointer of type atomic_t
8 * @hint: probable value of the atomic before the increment
10 * This version of atomic_inc_not_zero() gives a hint of probable
11 * value of the atomic. This helps processor to not read the memory
12 * before doing the atomic read/modify/write cycle, lowering
13 * number of bus transactions on some arches.
15 * Returns: 0 if increment was not done, 1 otherwise.
17 #ifndef atomic_inc_not_zero_hint
18 static inline int atomic_inc_not_zero_hint(atomic_t
*v
, int hint
)
22 /* sanity test, should be removed by compiler if hint is a constant */
24 return atomic_inc_not_zero(v
);
27 val
= atomic_cmpxchg(v
, c
, c
+ 1);
37 #endif /* _LINUX_ATOMIC_H */