diff options
author | Arun Sharma <asharma@fb.com> | 2011-07-26 19:09:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 19:49:47 -0400 |
commit | 60063497a95e716c9a689af3be2687d261f115b4 (patch) | |
tree | 6ce0d68db76982c53df46aee5f29f944ebf2c320 /include/linux/atomic.h | |
parent | 148817ba092f9f6edd35bad3c6c6b8e8f90fe2ed (diff) |
atomic: use <linux/atomic.h>
This allows us to move duplicated code in <asm/atomic.h>
(atomic_inc_not_zero() for now) to <linux/atomic.h>
Signed-off-by: Arun Sharma <asharma@fb.com>
Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: David Miller <davem@davemloft.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/atomic.h')
-rw-r--r-- | include/linux/atomic.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/atomic.h b/include/linux/atomic.h index bc6615d4132b..66fed6364122 100644 --- a/include/linux/atomic.h +++ b/include/linux/atomic.h | |||
@@ -3,6 +3,15 @@ | |||
3 | #include <asm/atomic.h> | 3 | #include <asm/atomic.h> |
4 | 4 | ||
5 | /** | 5 | /** |
6 | * atomic_inc_not_zero - increment unless the number is zero | ||
7 | * @v: pointer of type atomic_t | ||
8 | * | ||
9 | * Atomically increments @v by 1, so long as @v is non-zero. | ||
10 | * Returns non-zero if @v was non-zero, and zero otherwise. | ||
11 | */ | ||
12 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | ||
13 | |||
14 | /** | ||
6 | * atomic_inc_not_zero_hint - increment if not null | 15 | * atomic_inc_not_zero_hint - increment if not null |
7 | * @v: pointer of type atomic_t | 16 | * @v: pointer of type atomic_t |
8 | * @hint: probable value of the atomic before the increment | 17 | * @hint: probable value of the atomic before the increment |