NFC: Implement HCI driver or internal error management
authorEric Lapuyade <eric.lapuyade@intel.com>
Mon, 11 Jun 2012 13:06:56 +0000 (15:06 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 9 Jul 2012 20:42:09 +0000 (16:42 -0400)
If there is an ongoing HCI command executing, it will be completed,
thereby pushing the error up to the core. Otherwise, HCI will directly
notify the core with the error.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
net/nfc/hci/core.c

index 9a1a12f8687e57f06b27dff225b3bbd2807dc986..e6b2df3981b62fd5e88d4e9637c8669bcb153cb4 100644 (file)
@@ -736,10 +736,17 @@ EXPORT_SYMBOL(nfc_hci_get_clientdata);
 
 static void nfc_hci_failure(struct nfc_hci_dev *hdev, int err)
 {
-       /*
-        * TODO: lower layer has permanent failure.
-        * complete potential HCI command or send an empty tag discovered event
-        */
+       mutex_lock(&hdev->msg_tx_mutex);
+
+       if (hdev->cmd_pending_msg == NULL) {
+               nfc_driver_failure(hdev->ndev, err);
+               goto exit;
+       }
+
+       __nfc_hci_cmd_completion(hdev, err, NULL);
+
+exit:
+       mutex_unlock(&hdev->msg_tx_mutex);
 }
 
 void nfc_hci_driver_failure(struct nfc_hci_dev *hdev, int err)
This page took 0.030045 seconds and 5 git commands to generate.