123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #ifndef _LINUX_ATOMIC_H
- #define _LINUX_ATOMIC_H
- #include <linux/types.h>
- #include <asm/atomic.h>
- #include <asm/barrier.h>
- #define atomic_cond_read_acquire(v, c) smp_cond_load_acquire(&(v)->counter, (c))
- #define atomic_cond_read_relaxed(v, c) smp_cond_load_relaxed(&(v)->counter, (c))
- #define atomic64_cond_read_acquire(v, c) smp_cond_load_acquire(&(v)->counter, (c))
- #define atomic64_cond_read_relaxed(v, c) smp_cond_load_relaxed(&(v)->counter, (c))
- #ifndef __atomic_acquire_fence
- #define __atomic_acquire_fence smp_mb__after_atomic
- #endif
- #ifndef __atomic_release_fence
- #define __atomic_release_fence smp_mb__before_atomic
- #endif
- #ifndef __atomic_pre_full_fence
- #define __atomic_pre_full_fence smp_mb__before_atomic
- #endif
- #ifndef __atomic_post_full_fence
- #define __atomic_post_full_fence smp_mb__after_atomic
- #endif
- #define __atomic_op_acquire(op, args...) \
- ({ \
- typeof(op##_relaxed(args)) __ret = op##_relaxed(args); \
- __atomic_acquire_fence(); \
- __ret; \
- })
- #define __atomic_op_release(op, args...) \
- ({ \
- __atomic_release_fence(); \
- op##_relaxed(args); \
- })
- #define __atomic_op_fence(op, args...) \
- ({ \
- typeof(op##_relaxed(args)) __ret; \
- __atomic_pre_full_fence(); \
- __ret = op##_relaxed(args); \
- __atomic_post_full_fence(); \
- __ret; \
- })
- #include <linux/atomic/atomic-arch-fallback.h>
- #include <linux/atomic/atomic-long.h>
- #include <linux/atomic/atomic-instrumented.h>
- #endif
|