diff options
Diffstat (limited to 'include/asm-mips/local.h')
-rw-r--r-- | include/asm-mips/local.h | 69 |
1 files changed, 1 insertions, 68 deletions
diff --git a/include/asm-mips/local.h b/include/asm-mips/local.h index ed882c88e0ca..f9a5ce5c9af1 100644 --- a/include/asm-mips/local.h +++ b/include/asm-mips/local.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/percpu.h> | 4 | #include <linux/percpu.h> |
5 | #include <linux/bitops.h> | 5 | #include <linux/bitops.h> |
6 | #include <asm/atomic.h> | 6 | #include <asm/atomic.h> |
7 | #include <asm/cmpxchg.h> | ||
7 | #include <asm/war.h> | 8 | #include <asm/war.h> |
8 | 9 | ||
9 | typedef struct | 10 | typedef struct |
@@ -114,68 +115,6 @@ static __inline__ long local_sub_return(long i, local_t * l) | |||
114 | return result; | 115 | return result; |
115 | } | 116 | } |
116 | 117 | ||
117 | /* | ||
118 | * local_sub_if_positive - conditionally subtract integer from atomic variable | ||
119 | * @i: integer value to subtract | ||
120 | * @l: pointer of type local_t | ||
121 | * | ||
122 | * Atomically test @l and subtract @i if @l is greater or equal than @i. | ||
123 | * The function returns the old value of @l minus @i. | ||
124 | */ | ||
125 | static __inline__ long local_sub_if_positive(long i, local_t * l) | ||
126 | { | ||
127 | unsigned long result; | ||
128 | |||
129 | if (cpu_has_llsc && R10000_LLSC_WAR) { | ||
130 | unsigned long temp; | ||
131 | |||
132 | __asm__ __volatile__( | ||
133 | " .set mips3 \n" | ||
134 | "1:" __LL "%1, %2 # local_sub_if_positive\n" | ||
135 | " dsubu %0, %1, %3 \n" | ||
136 | " bltz %0, 1f \n" | ||
137 | __SC "%0, %2 \n" | ||
138 | " .set noreorder \n" | ||
139 | " beqzl %0, 1b \n" | ||
140 | " dsubu %0, %1, %3 \n" | ||
141 | " .set reorder \n" | ||
142 | "1: \n" | ||
143 | " .set mips0 \n" | ||
144 | : "=&r" (result), "=&r" (temp), "=m" (l->a.counter) | ||
145 | : "Ir" (i), "m" (l->a.counter) | ||
146 | : "memory"); | ||
147 | } else if (cpu_has_llsc) { | ||
148 | unsigned long temp; | ||
149 | |||
150 | __asm__ __volatile__( | ||
151 | " .set mips3 \n" | ||
152 | "1:" __LL "%1, %2 # local_sub_if_positive\n" | ||
153 | " dsubu %0, %1, %3 \n" | ||
154 | " bltz %0, 1f \n" | ||
155 | __SC "%0, %2 \n" | ||
156 | " .set noreorder \n" | ||
157 | " beqz %0, 1b \n" | ||
158 | " dsubu %0, %1, %3 \n" | ||
159 | " .set reorder \n" | ||
160 | "1: \n" | ||
161 | " .set mips0 \n" | ||
162 | : "=&r" (result), "=&r" (temp), "=m" (l->a.counter) | ||
163 | : "Ir" (i), "m" (l->a.counter) | ||
164 | : "memory"); | ||
165 | } else { | ||
166 | unsigned long flags; | ||
167 | |||
168 | local_irq_save(flags); | ||
169 | result = l->a.counter; | ||
170 | result -= i; | ||
171 | if (result >= 0) | ||
172 | l->a.counter = result; | ||
173 | local_irq_restore(flags); | ||
174 | } | ||
175 | |||
176 | return result; | ||
177 | } | ||
178 | |||
179 | #define local_cmpxchg(l, o, n) \ | 118 | #define local_cmpxchg(l, o, n) \ |
180 | ((long)cmpxchg_local(&((l)->a.counter), (o), (n))) | 119 | ((long)cmpxchg_local(&((l)->a.counter), (o), (n))) |
181 | #define local_xchg(l, n) (xchg_local(&((l)->a.counter),(n))) | 120 | #define local_xchg(l, n) (xchg_local(&((l)->a.counter),(n))) |
@@ -234,12 +173,6 @@ static __inline__ long local_sub_if_positive(long i, local_t * l) | |||
234 | #define local_dec_and_test(l) (local_sub_return(1, (l)) == 0) | 173 | #define local_dec_and_test(l) (local_sub_return(1, (l)) == 0) |
235 | 174 | ||
236 | /* | 175 | /* |
237 | * local_dec_if_positive - decrement by 1 if old value positive | ||
238 | * @l: pointer of type local_t | ||
239 | */ | ||
240 | #define local_dec_if_positive(l) local_sub_if_positive(1, l) | ||
241 | |||
242 | /* | ||
243 | * local_add_negative - add and test if negative | 176 | * local_add_negative - add and test if negative |
244 | * @l: pointer of type local_t | 177 | * @l: pointer of type local_t |
245 | * @i: integer value to add | 178 | * @i: integer value to add |