summaryrefslogtreecommitdiff
path: root/ANDROID_3.4.5/arch/microblaze/include/asm/atomic.h
diff options
context:
space:
mode:
Diffstat (limited to 'ANDROID_3.4.5/arch/microblaze/include/asm/atomic.h')
-rw-r--r--ANDROID_3.4.5/arch/microblaze/include/asm/atomic.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/ANDROID_3.4.5/arch/microblaze/include/asm/atomic.h b/ANDROID_3.4.5/arch/microblaze/include/asm/atomic.h
new file mode 100644
index 00000000..472d8bf7
--- /dev/null
+++ b/ANDROID_3.4.5/arch/microblaze/include/asm/atomic.h
@@ -0,0 +1,26 @@
+#ifndef _ASM_MICROBLAZE_ATOMIC_H
+#define _ASM_MICROBLAZE_ATOMIC_H
+
+#include <asm/cmpxchg.h>
+#include <asm-generic/atomic.h>
+#include <asm-generic/atomic64.h>
+
+/*
+ * Atomically test *v and decrement if it is greater than 0.
+ * The function returns the old value of *v minus 1.
+ */
+static inline int atomic_dec_if_positive(atomic_t *v)
+{
+ unsigned long flags;
+ int res;
+
+ local_irq_save(flags);
+ res = v->counter - 1;
+ if (res >= 0)
+ v->counter = res;
+ local_irq_restore(flags);
+
+ return res;
+}
+
+#endif /* _ASM_MICROBLAZE_ATOMIC_H */