Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] NFC: Complete NCI deactivate in deactivate_ntf
@ 2012-01-08  9:21 ilanelias78
  2012-01-16 18:03 ` Samuel Ortiz
  0 siblings, 1 reply; 2+ messages in thread
From: ilanelias78 @ 2012-01-08  9:21 UTC (permalink / raw)
  To: aloisio.almeida, lauro.venancio, samuel, linville
  Cc: linux-wireless, Ilan Elias

From: Ilan Elias <ilane@ti.com>

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>
---
 net/nfc/nci/ntf.c |    2 ++
 net/nfc/nci/rsp.c |    5 ++++-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c
index 5b2b013..a88be91 100644
--- a/net/nfc/nci/ntf.c
+++ b/net/nfc/nci/ntf.c
@@ -365,6 +365,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)
diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c
index 2840ae2..3c73e92 100644
--- a/net/nfc/nci/rsp.c
+++ b/net/nfc/nci/rsp.c
@@ -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)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-16 17:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-08  9:21 [PATCH] NFC: Complete NCI deactivate in deactivate_ntf ilanelias78
2012-01-16 18:03 ` Samuel Ortiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox