NFC: Check if NCI data flow control is used
authorIlan Elias <ilane@ti.com>
Wed, 9 Nov 2011 10:09:16 +0000 (12:09 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 11 Nov 2011 17:32:50 +0000 (12:32 -0500)
Check if NCI data flow control is used in nci_tx_work.

Signed-off-by: Ilan Elias <ilane@ti.com>
Acked-by: Lauro Ramos Venancio <lauro.venancio@openbossa.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
include/net/nfc/nci.h
net/nfc/nci/core.c

index 0b34fde9b130b0162e6321b47dd799baed43af0d..cdbe671393432e92015920e9827c9614ace17666 100644 (file)
 /* NCI Static RF connection ID */
 #define NCI_STATIC_RF_CONN_ID                                  0x00
 
+/* NCI Data Flow Control */
+#define NCI_DATA_FLOW_CONTROL_NOT_USED                         0xff
+
 /* NCI RF_DISCOVER_MAP_CMD modes */
 #define NCI_DISC_MAP_MODE_POLL                                 0x01
 #define NCI_DISC_MAP_MODE_LISTEN                               0x02
index 9d0b5305c36e8111688ca8dd0ea1f7b0313d7aa3..3dffcb3221cc682bebf0bd7bf2bdcb866060b3d7 100644 (file)
@@ -722,7 +722,10 @@ static void nci_tx_work(struct work_struct *work)
                if (!skb)
                        return;
 
-               atomic_dec(&ndev->credits_cnt);
+               /* Check if data flow control is used */
+               if (atomic_read(&ndev->credits_cnt) !=
+                               NCI_DATA_FLOW_CONTROL_NOT_USED)
+                       atomic_dec(&ndev->credits_cnt);
 
                nfc_dbg("NCI TX: MT=data, PBF=%d, conn_id=%d, plen=%d",
                                nci_pbf(skb->data),