Thread (19 messages) 19 messages, 15 authors, 2011-05-09

[PATCH] atomic: add *_dec_not_zero

From: James.Bottomley@HansenPartnership.com (James Bottomley)
Date: 2011-05-04 15:04:11
Also in: linux-alpha, linux-arch, linux-mips, linux-s390, linux-sh, linuxppc-dev, lkml, sparclinux

On Wed, 2011-05-04 at 00:44 -0400, Mike Frysinger wrote:
On Tue, May 3, 2011 at 17:30, Sven Eckelmann wrote:
quoted
Introduce an *_dec_not_zero operation.  Make this a special case of
*_add_unless because batman-adv uses atomic_dec_not_zero in different
places like re-broadcast queue or aggregation queue management. There
are other non-final patches which may also want to use this macro.

Cc: uclinux-dist-devel at blackfin.uclinux.org
--- a/arch/blackfin/include/asm/atomic.h
+++ b/arch/blackfin/include/asm/atomic.h
@@ -103,6 +103,7 @@ static inline int atomic_test_mask(int mask, atomic_t *v)
       c != (u);                                               \
 })
 #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
+#define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0)

 /*
 * atomic_inc_and_test - increment and test
no opinion on the actual idea, but for the Blackfin pieces:
Acked-by: Mike Frysinger <redacted>
This goes for parisc as well.

Acked-by: James Bottomley <James.Bottomley@HansenPartnership.com>

James
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help