14 #include <asm/assembler.h>
15 #include <asm/local.h>
29 #define LOCAL_INIT(i) { (i) }
37 #define local_read(l) ((l)->counter)
46 #define local_set(l, i) (((l)->counter) = (i))
62 "# local_add_return \n\t"
70 #ifdef CONFIG_CHIP_M32700_TS1
93 "# local_sub_return \n\t"
101 #ifdef CONFIG_CHIP_M32700_TS1
117 #define local_add(i, l) ((void) local_add_return((i), (l)))
126 #define local_sub(i, l) ((void) local_sub_return((i), (l)))
137 #define local_sub_and_test(i, l) (local_sub_return((i), (l)) == 0)
152 "# local_inc_return \n\t"
160 #ifdef CONFIG_CHIP_M32700_TS1
182 "# local_dec_return \n\t"
190 #ifdef CONFIG_CHIP_M32700_TS1
205 #define local_inc(l) ((void)local_inc_return(l))
213 #define local_dec(l) ((void)local_dec_return(l))
223 #define local_inc_and_test(l) (local_inc_return(l) == 0)
233 #define local_dec_and_test(l) (local_dec_return(l) == 0)
244 #define local_add_negative(i, l) (local_add_return((i), (l)) < 0)
246 #define local_cmpxchg(l, o, n) (cmpxchg_local(&((l)->counter), (o), (n)))
247 #define local_xchg(v, new) (xchg_local(&((l)->counter), new))
273 #define local_inc_not_zero(l) local_add_unless((l), 1, 0)
282 "# local_clear_mask \n\t"
288 :
"r" (addr),
"r" (~mask)
290 #ifdef CONFIG_CHIP_M32700_TS1
304 "# local_set_mask \n\t"
310 :
"r" (addr),
"r" (mask)
312 #ifdef CONFIG_CHIP_M32700_TS1
320 #define smp_mb__before_local_dec() barrier()
321 #define smp_mb__after_local_dec() barrier()
322 #define smp_mb__before_local_inc() barrier()
323 #define smp_mb__after_local_inc() barrier()
330 #define __local_inc(l) ((l)->a.counter++)
331 #define __local_dec(l) ((l)->a.counter++)
332 #define __local_add(i, l) ((l)->a.counter += (i))
333 #define __local_sub(i, l) ((l)->a.counter -= (i))