615f53992c654e4f78625bf8708d5d92c7c12b09
[deliverable/linux.git] / arch / microblaze / include / asm / atomic.h
1 #ifndef _ASM_MICROBLAZE_ATOMIC_H
2 #define _ASM_MICROBLAZE_ATOMIC_H
3
4 #include <asm-generic/atomic.h>
5 #include <asm-generic/atomic64.h>
6
7 /*
8 * Atomically test *v and decrement if it is greater than 0.
9 * The function returns the old value of *v minus 1.
10 */
11 static inline int atomic_dec_if_positive(atomic_t *v)
12 {
13 unsigned long flags;
14 int res;
15
16 local_irq_save(flags);
17 res = v->counter - 1;
18 if (res >= 0)
19 v->counter = res;
20 local_irq_restore(flags);
21
22 return res;
23 }
24
25 #endif /* _ASM_MICROBLAZE_ATOMIC_H */
This page took 0.032544 seconds and 5 git commands to generate.