diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2008-01-30 07:31:26 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:31:26 -0500 |
commit | 4ad02718345783a3b84bae1895917666b779850d (patch) | |
tree | ffeb70f577b394a042f5816afd0de081560b98e6 | |
parent | fe758fb1192790f8e465a7f59efe47ca73717d3e (diff) |
x86: clean up local_{32|64}.h
Common prefix from both files moved to local.h
Change __inline__ to inline
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | include/asm-x86/local_32.h | 34 | ||||
-rw-r--r-- | include/asm-x86/local_64.h | 25 |
2 files changed, 16 insertions, 43 deletions
diff --git a/include/asm-x86/local_32.h b/include/asm-x86/local_32.h index 6e85975b9ed2..33d9c7bf463c 100644 --- a/include/asm-x86/local_32.h +++ b/include/asm-x86/local_32.h | |||
@@ -1,35 +1,21 @@ | |||
1 | #ifndef _ARCH_I386_LOCAL_H | 1 | #ifndef _ARCH_I386_LOCAL_H |
2 | #define _ARCH_I386_LOCAL_H | 2 | #define _ARCH_I386_LOCAL_H |
3 | 3 | ||
4 | #include <linux/percpu.h> | 4 | static inline void local_inc(local_t *l) |
5 | #include <asm/system.h> | ||
6 | #include <asm/atomic.h> | ||
7 | |||
8 | typedef struct | ||
9 | { | ||
10 | atomic_long_t a; | ||
11 | } local_t; | ||
12 | |||
13 | #define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) } | ||
14 | |||
15 | #define local_read(l) atomic_long_read(&(l)->a) | ||
16 | #define local_set(l,i) atomic_long_set(&(l)->a, (i)) | ||
17 | |||
18 | static __inline__ void local_inc(local_t *l) | ||
19 | { | 5 | { |
20 | __asm__ __volatile__( | 6 | __asm__ __volatile__( |
21 | "incl %0" | 7 | "incl %0" |
22 | :"+m" (l->a.counter)); | 8 | :"+m" (l->a.counter)); |
23 | } | 9 | } |
24 | 10 | ||
25 | static __inline__ void local_dec(local_t *l) | 11 | static inline void local_dec(local_t *l) |
26 | { | 12 | { |
27 | __asm__ __volatile__( | 13 | __asm__ __volatile__( |
28 | "decl %0" | 14 | "decl %0" |
29 | :"+m" (l->a.counter)); | 15 | :"+m" (l->a.counter)); |
30 | } | 16 | } |
31 | 17 | ||
32 | static __inline__ void local_add(long i, local_t *l) | 18 | static inline void local_add(long i, local_t *l) |
33 | { | 19 | { |
34 | __asm__ __volatile__( | 20 | __asm__ __volatile__( |
35 | "addl %1,%0" | 21 | "addl %1,%0" |
@@ -37,7 +23,7 @@ static __inline__ void local_add(long i, local_t *l) | |||
37 | :"ir" (i)); | 23 | :"ir" (i)); |
38 | } | 24 | } |
39 | 25 | ||
40 | static __inline__ void local_sub(long i, local_t *l) | 26 | static inline void local_sub(long i, local_t *l) |
41 | { | 27 | { |
42 | __asm__ __volatile__( | 28 | __asm__ __volatile__( |
43 | "subl %1,%0" | 29 | "subl %1,%0" |
@@ -54,7 +40,7 @@ static __inline__ void local_sub(long i, local_t *l) | |||
54 | * true if the result is zero, or false for all | 40 | * true if the result is zero, or false for all |
55 | * other cases. | 41 | * other cases. |
56 | */ | 42 | */ |
57 | static __inline__ int local_sub_and_test(long i, local_t *l) | 43 | static inline int local_sub_and_test(long i, local_t *l) |
58 | { | 44 | { |
59 | unsigned char c; | 45 | unsigned char c; |
60 | 46 | ||
@@ -73,7 +59,7 @@ static __inline__ int local_sub_and_test(long i, local_t *l) | |||
73 | * returns true if the result is 0, or false for all other | 59 | * returns true if the result is 0, or false for all other |
74 | * cases. | 60 | * cases. |
75 | */ | 61 | */ |
76 | static __inline__ int local_dec_and_test(local_t *l) | 62 | static inline int local_dec_and_test(local_t *l) |
77 | { | 63 | { |
78 | unsigned char c; | 64 | unsigned char c; |
79 | 65 | ||
@@ -92,7 +78,7 @@ static __inline__ int local_dec_and_test(local_t *l) | |||
92 | * and returns true if the result is zero, or false for all | 78 | * and returns true if the result is zero, or false for all |
93 | * other cases. | 79 | * other cases. |
94 | */ | 80 | */ |
95 | static __inline__ int local_inc_and_test(local_t *l) | 81 | static inline int local_inc_and_test(local_t *l) |
96 | { | 82 | { |
97 | unsigned char c; | 83 | unsigned char c; |
98 | 84 | ||
@@ -112,7 +98,7 @@ static __inline__ int local_inc_and_test(local_t *l) | |||
112 | * if the result is negative, or false when | 98 | * if the result is negative, or false when |
113 | * result is greater than or equal to zero. | 99 | * result is greater than or equal to zero. |
114 | */ | 100 | */ |
115 | static __inline__ int local_add_negative(long i, local_t *l) | 101 | static inline int local_add_negative(long i, local_t *l) |
116 | { | 102 | { |
117 | unsigned char c; | 103 | unsigned char c; |
118 | 104 | ||
@@ -130,7 +116,7 @@ static __inline__ int local_add_negative(long i, local_t *l) | |||
130 | * | 116 | * |
131 | * Atomically adds @i to @l and returns @i + @l | 117 | * Atomically adds @i to @l and returns @i + @l |
132 | */ | 118 | */ |
133 | static __inline__ long local_add_return(long i, local_t *l) | 119 | static inline long local_add_return(long i, local_t *l) |
134 | { | 120 | { |
135 | long __i; | 121 | long __i; |
136 | #ifdef CONFIG_M386 | 122 | #ifdef CONFIG_M386 |
@@ -156,7 +142,7 @@ no_xadd: /* Legacy 386 processor */ | |||
156 | #endif | 142 | #endif |
157 | } | 143 | } |
158 | 144 | ||
159 | static __inline__ long local_sub_return(long i, local_t *l) | 145 | static inline long local_sub_return(long i, local_t *l) |
160 | { | 146 | { |
161 | return local_add_return(-i,l); | 147 | return local_add_return(-i,l); |
162 | } | 148 | } |
diff --git a/include/asm-x86/local_64.h b/include/asm-x86/local_64.h index e87492bb0693..92330f8135f8 100644 --- a/include/asm-x86/local_64.h +++ b/include/asm-x86/local_64.h | |||
@@ -1,19 +1,6 @@ | |||
1 | #ifndef _ARCH_X8664_LOCAL_H | 1 | #ifndef _ARCH_X8664_LOCAL_H |
2 | #define _ARCH_X8664_LOCAL_H | 2 | #define _ARCH_X8664_LOCAL_H |
3 | 3 | ||
4 | #include <linux/percpu.h> | ||
5 | #include <asm/atomic.h> | ||
6 | |||
7 | typedef struct | ||
8 | { | ||
9 | atomic_long_t a; | ||
10 | } local_t; | ||
11 | |||
12 | #define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) } | ||
13 | |||
14 | #define local_read(l) atomic_long_read(&(l)->a) | ||
15 | #define local_set(l,i) atomic_long_set(&(l)->a, (i)) | ||
16 | |||
17 | static inline void local_inc(local_t *l) | 4 | static inline void local_inc(local_t *l) |
18 | { | 5 | { |
19 | __asm__ __volatile__( | 6 | __asm__ __volatile__( |
@@ -55,7 +42,7 @@ static inline void local_sub(long i, local_t *l) | |||
55 | * true if the result is zero, or false for all | 42 | * true if the result is zero, or false for all |
56 | * other cases. | 43 | * other cases. |
57 | */ | 44 | */ |
58 | static __inline__ int local_sub_and_test(long i, local_t *l) | 45 | static inline int local_sub_and_test(long i, local_t *l) |
59 | { | 46 | { |
60 | unsigned char c; | 47 | unsigned char c; |
61 | 48 | ||
@@ -74,7 +61,7 @@ static __inline__ int local_sub_and_test(long i, local_t *l) | |||
74 | * returns true if the result is 0, or false for all other | 61 | * returns true if the result is 0, or false for all other |
75 | * cases. | 62 | * cases. |
76 | */ | 63 | */ |
77 | static __inline__ int local_dec_and_test(local_t *l) | 64 | static inline int local_dec_and_test(local_t *l) |
78 | { | 65 | { |
79 | unsigned char c; | 66 | unsigned char c; |
80 | 67 | ||
@@ -93,7 +80,7 @@ static __inline__ int local_dec_and_test(local_t *l) | |||
93 | * and returns true if the result is zero, or false for all | 80 | * and returns true if the result is zero, or false for all |
94 | * other cases. | 81 | * other cases. |
95 | */ | 82 | */ |
96 | static __inline__ int local_inc_and_test(local_t *l) | 83 | static inline int local_inc_and_test(local_t *l) |
97 | { | 84 | { |
98 | unsigned char c; | 85 | unsigned char c; |
99 | 86 | ||
@@ -113,7 +100,7 @@ static __inline__ int local_inc_and_test(local_t *l) | |||
113 | * if the result is negative, or false when | 100 | * if the result is negative, or false when |
114 | * result is greater than or equal to zero. | 101 | * result is greater than or equal to zero. |
115 | */ | 102 | */ |
116 | static __inline__ int local_add_negative(long i, local_t *l) | 103 | static inline int local_add_negative(long i, local_t *l) |
117 | { | 104 | { |
118 | unsigned char c; | 105 | unsigned char c; |
119 | 106 | ||
@@ -131,7 +118,7 @@ static __inline__ int local_add_negative(long i, local_t *l) | |||
131 | * | 118 | * |
132 | * Atomically adds @i to @l and returns @i + @l | 119 | * Atomically adds @i to @l and returns @i + @l |
133 | */ | 120 | */ |
134 | static __inline__ long local_add_return(long i, local_t *l) | 121 | static inline long local_add_return(long i, local_t *l) |
135 | { | 122 | { |
136 | long __i = i; | 123 | long __i = i; |
137 | __asm__ __volatile__( | 124 | __asm__ __volatile__( |
@@ -141,7 +128,7 @@ static __inline__ long local_add_return(long i, local_t *l) | |||
141 | return i + __i; | 128 | return i + __i; |
142 | } | 129 | } |
143 | 130 | ||
144 | static __inline__ long local_sub_return(long i, local_t *l) | 131 | static inline long local_sub_return(long i, local_t *l) |
145 | { | 132 | { |
146 | return local_add_return(-i,l); | 133 | return local_add_return(-i,l); |
147 | } | 134 | } |