Skip to content

Commit

Permalink
[S390] atomic: use ACCESS_ONCE() for atomic_read()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Heiko Carstens authored and Martin Schwidefsky committed Feb 17, 2011
1 parent 5da24b7 commit 03e3b5a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions arch/s390/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@

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)
Expand Down Expand Up @@ -128,14 +126,12 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)

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)
Expand Down

0 comments on commit 03e3b5a

Please sign in to comment.