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