diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2012-10-09 10:03:21 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-10-09 10:04:25 -0400 |
commit | ffe315012510165ce82e4dd4767f0a5dba9edbf7 (patch) | |
tree | f601cd980af9d0ced5ca9aedecef4fa0d2ca0e15 /include/linux/atomic.h | |
parent | e2d3a35ee427aaba99b6c68a56609ce276c51270 (diff) | |
parent | 4a8e43feeac7996b8de2d5b2823e316917493df4 (diff) |
Merge tag 'disintegrate-mtd-20121009' of git://git.infradead.org/users/dhowells/linux-headers
UAPI Disintegration 2012-10-09
Conflicts:
MAINTAINERS
arch/arm/configs/bcmring_defconfig
arch/arm/mach-imx/clk-imx51-imx53.c
drivers/mtd/nand/Kconfig
drivers/mtd/nand/bcm_umi_nand.c
drivers/mtd/nand/nand_bcm_umi.h
drivers/mtd/nand/orion_nand.c
Diffstat (limited to 'include/linux/atomic.h')
-rw-r--r-- | include/linux/atomic.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/linux/atomic.h b/include/linux/atomic.h index 70cfcb2d63c4..5b08a8540ecf 100644 --- a/include/linux/atomic.h +++ b/include/linux/atomic.h | |||
@@ -86,6 +86,31 @@ static inline int atomic_dec_unless_positive(atomic_t *p) | |||
86 | } | 86 | } |
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | /* | ||
90 | * atomic_dec_if_positive - decrement by 1 if old value positive | ||
91 | * @v: pointer of type atomic_t | ||
92 | * | ||
93 | * The function returns the old value of *v minus 1, even if | ||
94 | * the atomic variable, v, was not decremented. | ||
95 | */ | ||
96 | #ifndef atomic_dec_if_positive | ||
97 | static inline int atomic_dec_if_positive(atomic_t *v) | ||
98 | { | ||
99 | int c, old, dec; | ||
100 | c = atomic_read(v); | ||
101 | for (;;) { | ||
102 | dec = c - 1; | ||
103 | if (unlikely(dec < 0)) | ||
104 | break; | ||
105 | old = atomic_cmpxchg((v), c, dec); | ||
106 | if (likely(old == c)) | ||
107 | break; | ||
108 | c = old; | ||
109 | } | ||
110 | return dec; | ||
111 | } | ||
112 | #endif | ||
113 | |||
89 | #ifndef CONFIG_ARCH_HAS_ATOMIC_OR | 114 | #ifndef CONFIG_ARCH_HAS_ATOMIC_OR |
90 | static inline void atomic_or(int i, atomic_t *v) | 115 | static inline void atomic_or(int i, atomic_t *v) |
91 | { | 116 | { |