diff options
author | Brian Behlendorf <[email protected]> | 2009-10-30 13:53:17 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2009-10-30 13:53:17 -0700 |
commit | 302b88e6abc3efe86411f9622b0a27a5b8b1f417 (patch) | |
tree | 1290c23f91ff930e53ab796ef6fd21fa7a0295a6 /include | |
parent | 5e9b5d832b228b0628a61c9c1c9bf0b05d2fe122 (diff) |
Add autoconf checks for atomic64_cmpxchg + atomic64_xchg
These functions didn't exist for all archs prior to 2.6.24. This
patch addes an autoconf test to detect this and add them when needed.
The autoconf check is needed instead of just an #ifndef because in
the most modern kernels atomic64_{cmp}xchg are implemented as in
inline function and not a #define.
Diffstat (limited to 'include')
-rw-r--r-- | include/asm/atomic_compat.h | 8 | ||||
-rw-r--r-- | include/sys/atomic.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/asm/atomic_compat.h b/include/asm/atomic_compat.h index 2f7376925..c769d6248 100644 --- a/include/asm/atomic_compat.h +++ b/include/asm/atomic_compat.h @@ -55,5 +55,13 @@ static inline void atomic64_set(atomic64_t *v, __s64 i) #endif /* HAVE_ATOMIC64_T */ +#ifndef HAVE_ATOMIC64_CMPXCHG +#define atomic64_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n))) +#endif + +#ifndef HAVE_ATOMIC64_XCHG +#define atomic64_xchg(v, n) (xchg(&((v)->counter), n)) +#endif + #endif /* _SPL_ATOMIC_COMPAT_H */ diff --git a/include/sys/atomic.h b/include/sys/atomic.h index 4f4a1e058..7a741de17 100644 --- a/include/sys/atomic.h +++ b/include/sys/atomic.h @@ -30,6 +30,7 @@ #include <linux/module.h> #include <linux/spinlock.h> #include <sys/types.h> +#include <asm/atomic_compat.h> /* * Two approaches to atomic operations are implemented each with its |