Let's make atomic_read() and atomic_set() behave like on all/most other
architectures. Generated code is identical with gcc 4.5.2.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
static inline int atomic_read(const atomic_t *v)
{
- barrier();
- return v->counter;
+ return ACCESS_ONCE(v->counter);
}
static inline void atomic_set(atomic_t *v, int i)
{
v->counter = i;
- barrier();
}
static inline int atomic_add_return(int i, atomic_t *v)
static inline long long atomic64_read(const atomic64_t *v)
{
- barrier();
- return v->counter;
+ return ACCESS_ONCE(v->counter);
}
static inline void atomic64_set(atomic64_t *v, long long i)
{
v->counter = i;
- barrier();
}
static inline long long atomic64_add_return(long long i, atomic64_t *v)