summaryrefslogtreecommitdiffstats
path: root/net/nfc/nci/data.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/nfc/nci/data.c')
-rw-r--r--net/nfc/nci/data.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/net/nfc/nci/data.c b/net/nfc/nci/data.c
index e5756b30e602..a0bc326308a5 100644
--- a/net/nfc/nci/data.c
+++ b/net/nfc/nci/data.c
@@ -35,8 +35,7 @@
#include <linux/nfc.h>
/* Complete data exchange transaction and forward skb to nfc core */
-void nci_data_exchange_complete(struct nci_dev *ndev,
- struct sk_buff *skb,
+void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb,
int err)
{
data_exchange_cb_t cb = ndev->data_exchange_cb;
@@ -44,6 +43,10 @@ void nci_data_exchange_complete(struct nci_dev *ndev,
pr_debug("len %d, err %d\n", skb ? skb->len : 0, err);
+ /* data exchange is complete, stop the data timer */
+ del_timer_sync(&ndev->data_timer);
+ clear_bit(NCI_DATA_EXCHANGE_TO, &ndev->flags);
+
if (cb) {
ndev->data_exchange_cb = NULL;
ndev->data_exchange_cb_context = 0;
@@ -63,9 +66,9 @@ void nci_data_exchange_complete(struct nci_dev *ndev,
/* ----------------- NCI TX Data ----------------- */
static inline void nci_push_data_hdr(struct nci_dev *ndev,
- __u8 conn_id,
- struct sk_buff *skb,
- __u8 pbf)
+ __u8 conn_id,
+ struct sk_buff *skb,
+ __u8 pbf)
{
struct nci_data_hdr *hdr;
int plen = skb->len;
@@ -82,8 +85,8 @@ static inline void nci_push_data_hdr(struct nci_dev *ndev,
}
static int nci_queue_tx_data_frags(struct nci_dev *ndev,
- __u8 conn_id,
- struct sk_buff *skb) {
+ __u8 conn_id,
+ struct sk_buff *skb) {
int total_len = skb->len;
unsigned char *data = skb->data;
unsigned long flags;
@@ -101,8 +104,8 @@ static int nci_queue_tx_data_frags(struct nci_dev *ndev,
min_t(int, total_len, ndev->max_data_pkt_payload_size);
skb_frag = nci_skb_alloc(ndev,
- (NCI_DATA_HDR_SIZE + frag_len),
- GFP_KERNEL);
+ (NCI_DATA_HDR_SIZE + frag_len),
+ GFP_KERNEL);
if (skb_frag == NULL) {
rc = -ENOMEM;
goto free_exit;
@@ -114,7 +117,8 @@ static int nci_queue_tx_data_frags(struct nci_dev *ndev,
/* second, set the header */
nci_push_data_hdr(ndev, conn_id, skb_frag,
- ((total_len == frag_len) ? (NCI_PBF_LAST) : (NCI_PBF_CONT)));
+ ((total_len == frag_len) ?
+ (NCI_PBF_LAST) : (NCI_PBF_CONT)));
__skb_queue_tail(&frags_q, skb_frag);
@@ -182,8 +186,8 @@ exit:
/* ----------------- NCI RX Data ----------------- */
static void nci_add_rx_data_frag(struct nci_dev *ndev,
- struct sk_buff *skb,
- __u8 pbf)
+ struct sk_buff *skb,
+ __u8 pbf)
{
int reassembly_len;
int err = 0;
@@ -207,8 +211,8 @@ static void nci_add_rx_data_frag(struct nci_dev *ndev,
/* second, combine the two fragments */
memcpy(skb_push(skb, reassembly_len),
- ndev->rx_data_reassembly->data,
- reassembly_len);
+ ndev->rx_data_reassembly->data,
+ reassembly_len);
/* third, free old reassembly */
kfree_skb(ndev->rx_data_reassembly);
OpenPOWER on IntegriCloud