Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 80019
b: refs/heads/master
c: 4ad0271
h: refs/heads/master
i:
  80017: d43277f
  80015: 95aa07a
v: v3
  • Loading branch information
Harvey Harrison authored and Ingo Molnar committed Jan 30, 2008
1 parent 97192fa commit 23cb557
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 44 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: fe758fb1192790f8e465a7f59efe47ca73717d3e
refs/heads/master: 4ad02718345783a3b84bae1895917666b779850d
34 changes: 10 additions & 24 deletions trunk/include/asm-x86/local_32.h
Original file line number Diff line number Diff line change
@@ -1,43 +1,29 @@
#ifndef _ARCH_I386_LOCAL_H
#define _ARCH_I386_LOCAL_H

#include <linux/percpu.h>
#include <asm/system.h>
#include <asm/atomic.h>

typedef struct
{
atomic_long_t a;
} local_t;

#define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) }

#define local_read(l) atomic_long_read(&(l)->a)
#define local_set(l,i) atomic_long_set(&(l)->a, (i))

static __inline__ void local_inc(local_t *l)
static inline void local_inc(local_t *l)
{
__asm__ __volatile__(
"incl %0"
:"+m" (l->a.counter));
}

static __inline__ void local_dec(local_t *l)
static inline void local_dec(local_t *l)
{
__asm__ __volatile__(
"decl %0"
:"+m" (l->a.counter));
}

static __inline__ void local_add(long i, local_t *l)
static inline void local_add(long i, local_t *l)
{
__asm__ __volatile__(
"addl %1,%0"
:"+m" (l->a.counter)
:"ir" (i));
}

static __inline__ void local_sub(long i, local_t *l)
static inline void local_sub(long i, local_t *l)
{
__asm__ __volatile__(
"subl %1,%0"
Expand All @@ -54,7 +40,7 @@ static __inline__ void local_sub(long i, local_t *l)
* true if the result is zero, or false for all
* other cases.
*/
static __inline__ int local_sub_and_test(long i, local_t *l)
static inline int local_sub_and_test(long i, local_t *l)
{
unsigned char c;

Expand All @@ -73,7 +59,7 @@ static __inline__ int local_sub_and_test(long i, local_t *l)
* returns true if the result is 0, or false for all other
* cases.
*/
static __inline__ int local_dec_and_test(local_t *l)
static inline int local_dec_and_test(local_t *l)
{
unsigned char c;

Expand All @@ -92,7 +78,7 @@ static __inline__ int local_dec_and_test(local_t *l)
* and returns true if the result is zero, or false for all
* other cases.
*/
static __inline__ int local_inc_and_test(local_t *l)
static inline int local_inc_and_test(local_t *l)
{
unsigned char c;

Expand All @@ -112,7 +98,7 @@ static __inline__ int local_inc_and_test(local_t *l)
* if the result is negative, or false when
* result is greater than or equal to zero.
*/
static __inline__ int local_add_negative(long i, local_t *l)
static inline int local_add_negative(long i, local_t *l)
{
unsigned char c;

Expand All @@ -130,7 +116,7 @@ static __inline__ int local_add_negative(long i, local_t *l)
*
* Atomically adds @i to @l and returns @i + @l
*/
static __inline__ long local_add_return(long i, local_t *l)
static inline long local_add_return(long i, local_t *l)
{
long __i;
#ifdef CONFIG_M386
Expand All @@ -156,7 +142,7 @@ static __inline__ long local_add_return(long i, local_t *l)
#endif
}

static __inline__ long local_sub_return(long i, local_t *l)
static inline long local_sub_return(long i, local_t *l)
{
return local_add_return(-i,l);
}
Expand Down
25 changes: 6 additions & 19 deletions trunk/include/asm-x86/local_64.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
#ifndef _ARCH_X8664_LOCAL_H
#define _ARCH_X8664_LOCAL_H

#include <linux/percpu.h>
#include <asm/atomic.h>

typedef struct
{
atomic_long_t a;
} local_t;

#define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) }

#define local_read(l) atomic_long_read(&(l)->a)
#define local_set(l,i) atomic_long_set(&(l)->a, (i))

static inline void local_inc(local_t *l)
{
__asm__ __volatile__(
Expand Down Expand Up @@ -55,7 +42,7 @@ static inline void local_sub(long i, local_t *l)
* true if the result is zero, or false for all
* other cases.
*/
static __inline__ int local_sub_and_test(long i, local_t *l)
static inline int local_sub_and_test(long i, local_t *l)
{
unsigned char c;

Expand All @@ -74,7 +61,7 @@ static __inline__ int local_sub_and_test(long i, local_t *l)
* returns true if the result is 0, or false for all other
* cases.
*/
static __inline__ int local_dec_and_test(local_t *l)
static inline int local_dec_and_test(local_t *l)
{
unsigned char c;

Expand All @@ -93,7 +80,7 @@ static __inline__ int local_dec_and_test(local_t *l)
* and returns true if the result is zero, or false for all
* other cases.
*/
static __inline__ int local_inc_and_test(local_t *l)
static inline int local_inc_and_test(local_t *l)
{
unsigned char c;

Expand All @@ -113,7 +100,7 @@ static __inline__ int local_inc_and_test(local_t *l)
* if the result is negative, or false when
* result is greater than or equal to zero.
*/
static __inline__ int local_add_negative(long i, local_t *l)
static inline int local_add_negative(long i, local_t *l)
{
unsigned char c;

Expand All @@ -131,7 +118,7 @@ static __inline__ int local_add_negative(long i, local_t *l)
*
* Atomically adds @i to @l and returns @i + @l
*/
static __inline__ long local_add_return(long i, local_t *l)
static inline long local_add_return(long i, local_t *l)
{
long __i = i;
__asm__ __volatile__(
Expand All @@ -141,7 +128,7 @@ static __inline__ long local_add_return(long i, local_t *l)
return i + __i;
}

static __inline__ long local_sub_return(long i, local_t *l)
static inline long local_sub_return(long i, local_t *l)
{
return local_add_return(-i,l);
}
Expand Down

0 comments on commit 23cb557

Please sign in to comment.