From bd7e01bc7e7a90b33470173618f6f6805143cd42 Mon Sep 17 00:00:00 2001 From: Ilan Elias Date: Sun, 8 Jan 2012 11:21:53 +0200 Subject: NFC: Complete NCI deactivate in deactivate_ntf 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 Acked-by: Samuel Ortiz Signed-off-by: John W. Linville --- net/nfc/nci/rsp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'net/nfc/nci/rsp.c') diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c index 2840ae2f3615..3c73e92eb625 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) -- cgit v1.2.3-58-ga151