Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 155215
b: refs/heads/master
c: 8e049ef
h: refs/heads/master
i:
  155213: 1fa74c3
  155211: 8057048
  155207: 937a003
  155199: 6fb4d90
v: v3
  • Loading branch information
Paul Mackerras authored and Ingo Molnar committed Jul 3, 2009
1 parent 9a85a2a commit 11a18aa
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 199e23780a7e75c63a9e3d1108804e3af450ea3e
refs/heads/master: 8e049ef054f1cc765f05f13e1396bb9a17c19e66
16 changes: 13 additions & 3 deletions trunk/arch/x86/include/asm/atomic_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ static inline int atomic_read(const atomic_t *v)
*
* Atomically sets the value of @v to @i.
*/
#define atomic_set(v, i) (((v)->counter) = (i))
static inline void atomic_set(atomic_t *v, int i)
{
v->counter = i;
}

/**
* atomic_add - add integer to atomic variable
Expand Down Expand Up @@ -203,8 +206,15 @@ static inline int atomic_sub_return(int i, atomic_t *v)
return atomic_add_return(-i, v);
}

#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
#define atomic_xchg(v, new) (xchg(&((v)->counter), (new)))
static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
{
return cmpxchg(&v->counter, old, new);
}

static inline int atomic_xchg(atomic_t *v, int new)
{
return xchg(&v->counter, new);
}

/**
* atomic_add_unless - add unless the number is already a given value
Expand Down
42 changes: 34 additions & 8 deletions trunk/arch/x86/include/asm/atomic_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
*
* Atomically reads the value of @v.
*/
#define atomic_read(v) ((v)->counter)
static inline int atomic_read(const atomic_t *v)
{
return v->counter;
}

/**
* atomic_set - set atomic variable
Expand All @@ -27,7 +30,10 @@
*
* Atomically sets the value of @v to @i.
*/
#define atomic_set(v, i) (((v)->counter) = (i))
static inline void atomic_set(atomic_t *v, int i)
{
v->counter = i;
}

/**
* atomic_add - add integer to atomic variable
Expand Down Expand Up @@ -192,7 +198,10 @@ static inline int atomic_sub_return(int i, atomic_t *v)
* Atomically reads the value of @v.
* Doesn't imply a read memory barrier.
*/
#define atomic64_read(v) ((v)->counter)
static inline long atomic64_read(const atomic64_t *v)
{
return v->counter;
}

/**
* atomic64_set - set atomic64 variable
Expand All @@ -201,7 +210,10 @@ static inline int atomic_sub_return(int i, atomic_t *v)
*
* Atomically sets the value of @v to @i.
*/
#define atomic64_set(v, i) (((v)->counter) = (i))
static inline void atomic64_set(atomic64_t *v, long i)
{
v->counter = i;
}

/**
* atomic64_add - add integer to atomic64 variable
Expand Down Expand Up @@ -355,11 +367,25 @@ static inline long atomic64_sub_return(long i, atomic64_t *v)
#define atomic64_inc_return(v) (atomic64_add_return(1, (v)))
#define atomic64_dec_return(v) (atomic64_sub_return(1, (v)))

#define atomic64_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
#define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
static inline long atomic64_cmpxchg(atomic64_t *v, long old, long new)
{
return cmpxchg(&v->counter, old, new);
}

static inline long atomic64_xchg(atomic64_t *v, long new)
{
return xchg(&v->counter, new);
}

#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
#define atomic_xchg(v, new) (xchg(&((v)->counter), (new)))
static inline long atomic_cmpxchg(atomic_t *v, int old, int new)
{
return cmpxchg(&v->counter, old, new);
}

static inline long atomic_xchg(atomic_t *v, int new)
{
return xchg(&v->counter, new);
}

/**
* atomic_add_unless - add unless the number is a given value
Expand Down

0 comments on commit 11a18aa

Please sign in to comment.