From: Ilan Elias Date: Wed, 9 Nov 2011 10:09:16 +0000 (+0200) Subject: NFC: Check if NCI data flow control is used X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=db98c829b70e0a313e627d1c63cf5a7087290e5c;p=openwrt%2Fstaging%2Fblogic.git NFC: Check if NCI data flow control is used Check if NCI data flow control is used in nci_tx_work. Signed-off-by: Ilan Elias Acked-by: Lauro Ramos Venancio Signed-off-by: John W. Linville --- diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h index 0b34fde9b130..cdbe67139343 100644 --- a/include/net/nfc/nci.h +++ b/include/net/nfc/nci.h @@ -108,6 +108,9 @@ /* 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 diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 9d0b5305c36e..3dffcb3221cc 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c @@ -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),