]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/microblaze/include/asm/atomic.h
Merge tag 'char-misc-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[mirror_ubuntu-artful-kernel.git] / arch / microblaze / include / asm / atomic.h
CommitLineData
10713b1d
MS
1#ifndef _ASM_MICROBLAZE_ATOMIC_H
2#define _ASM_MICROBLAZE_ATOMIC_H
3
0a584583 4#include <asm-generic/atomic.h>
eacb6ec9 5#include <asm-generic/atomic64.h>
10713b1d
MS
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 */
11static 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
10713b1d 25#endif /* _ASM_MICROBLAZE_ATOMIC_H */