1 #ifndef _COMPAT_LINUX_ATOMIC_H
2 #define _COMPAT_LINUX_ATOMIC_H 1
5 #include <linux/version.h>
7 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
8 #include_next <linux/atomic.h>
12 #include <asm/atomic.h>
14 /* Shahar Klein: atomic_inc_not_zero_hint do we need it? */
18 * atomic_inc_not_zero_hint - increment if not null
19 * @v: pointer of type atomic_t
20 * @hint: probable value of the atomic before the increment
22 * This version of atomic_inc_not_zero() gives a hint of probable
23 * value of the atomic. This helps processor to not read the memory
24 * before doing the atomic read/modify/write cycle, lowering
25 * number of bus transactions on some arches.
27 * Returns: 0 if increment was not done, 1 otherwise.
30 #ifndef atomic_inc_not_zero_hint
31 static inline int atomic_inc_not_zero_hint(atomic_t *v, int hint)
35 /* sanity test, should be removed by compiler if hint is a constant */
37 return atomic_inc_not_zero(v);
40 val = atomic_cmpxchg(v, c, c + 1);
51 //#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36)) */
53 #endif /* _COMPAT_LINUX_ATOMIC_H */