NFC: Complete NCI deactivate in deactivate_ntf
authorIlan Elias <ilane@ti.com>
Sun, 8 Jan 2012 09:21:53 +0000 (11:21 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 24 Jan 2012 19:08:38 +0000 (14:08 -0500)
If a target was active, complete the NCI deactivate request
only in deactivate_ntf. Otherwise, complete it at deactivate_rsp.
Deactivate_ntf represents the actual disconnection event (sent from
the NCI controller).

Signed-off-by: Ilan Elias <ilane@ti.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/nfc/nci/ntf.c
net/nfc/nci/rsp.c

index b16a8dc2afbe7fcd457787791f887092985021e5..10682bf7029db13ab78de2ab6dd33a3c7918785d 100644 (file)
@@ -280,6 +280,8 @@ static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev,
        /* complete the data exchange transaction, if exists */
        if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags))
                nci_data_exchange_complete(ndev, NULL, -EIO);
+
+       nci_req_complete(ndev, NCI_STATUS_OK);
 }
 
 void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb)
index 2840ae2f361527e278ae871a84f18f968d612057..3c73e92eb6257fa1c8f807ad4e8dec1989a0a3dd 100644 (file)
@@ -151,7 +151,10 @@ static void nci_rf_deactivate_rsp_packet(struct nci_dev *ndev,
 
        clear_bit(NCI_DISCOVERY, &ndev->flags);
 
-       nci_req_complete(ndev, status);
+       /* If target was active, complete the request only in deactivate_ntf */
+       if ((status != NCI_STATUS_OK) ||
+               (!test_bit(NCI_POLL_ACTIVE, &ndev->flags)))
+               nci_req_complete(ndev, status);
 }
 
 void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)