[PATCHv4 11/11] Phonet: Use *_dec_not_zero instead of *_add_unless

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



atomic_dec_not_zero is defined for each architecture through
<linux/atomic.h> to provide the functionality of
atomic_add_unless(x, -1, 0).

Signed-off-by: Sven Eckelmann <sven@xxxxxxxxxxxxx>
Cc: Remi Denis-Courmont <remi.denis-courmont@xxxxxxxxx>
---
 net/phonet/pep.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/phonet/pep.c b/net/phonet/pep.c
index f17fd84..b192c83 100644
--- a/net/phonet/pep.c
+++ b/net/phonet/pep.c
@@ -1013,7 +1013,7 @@ static int pipe_skb_send(struct sock *sk, struct sk_buff *skb)
 	int err;
 
 	if (pn_flow_safe(pn->tx_fc) &&
-	    !atomic_add_unless(&pn->tx_credits, -1, 0)) {
+	    !atomic_dec_not_zero(&pn->tx_credits)) {
 		kfree_skb(skb);
 		return -ENOBUFS;
 	}
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux