Commit a9a741a7 authored by Eric Lapuyade's avatar Eric Lapuyade Committed by John W. Linville

NFC: Prepare asynchronous error management for driver and shdlc

Signed-off-by: default avatarEric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent c32cdbd8
...@@ -112,6 +112,8 @@ void nfc_hci_unregister_device(struct nfc_hci_dev *hdev); ...@@ -112,6 +112,8 @@ void nfc_hci_unregister_device(struct nfc_hci_dev *hdev);
void nfc_hci_set_clientdata(struct nfc_hci_dev *hdev, void *clientdata); void nfc_hci_set_clientdata(struct nfc_hci_dev *hdev, void *clientdata);
void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev); void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev);
void nfc_hci_driver_failure(struct nfc_hci_dev *hdev, int err);
/* Host IDs */ /* Host IDs */
#define NFC_HCI_HOST_CONTROLLER_ID 0x00 #define NFC_HCI_HOST_CONTROLLER_ID 0x00
#define NFC_HCI_TERMINAL_HOST_ID 0x01 #define NFC_HCI_TERMINAL_HOST_ID 0x01
......
...@@ -717,6 +717,14 @@ void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev) ...@@ -717,6 +717,14 @@ void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev)
} }
EXPORT_SYMBOL(nfc_hci_get_clientdata); EXPORT_SYMBOL(nfc_hci_get_clientdata);
void nfc_hci_driver_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
*/
}
EXPORT_SYMBOL(nfc_hci_driver_failure);
void nfc_hci_recv_frame(struct nfc_hci_dev *hdev, struct sk_buff *skb) void nfc_hci_recv_frame(struct nfc_hci_dev *hdev, struct sk_buff *skb)
{ {
struct hcp_packet *packet; struct hcp_packet *packet;
......
...@@ -523,10 +523,6 @@ static void nfc_shdlc_handle_send_queue(struct nfc_shdlc *shdlc) ...@@ -523,10 +523,6 @@ static void nfc_shdlc_handle_send_queue(struct nfc_shdlc *shdlc)
r = shdlc->ops->xmit(shdlc, skb); r = shdlc->ops->xmit(shdlc, skb);
if (r < 0) { if (r < 0) {
/*
* TODO: Cannot send, shdlc machine is dead, we
* must propagate the information up to HCI.
*/
shdlc->hard_fault = r; shdlc->hard_fault = r;
break; break;
} }
...@@ -590,6 +586,11 @@ static void nfc_shdlc_sm_work(struct work_struct *work) ...@@ -590,6 +586,11 @@ static void nfc_shdlc_sm_work(struct work_struct *work)
skb_queue_purge(&shdlc->ack_pending_q); skb_queue_purge(&shdlc->ack_pending_q);
break; break;
case SHDLC_CONNECTING: case SHDLC_CONNECTING:
if (shdlc->hard_fault) {
nfc_shdlc_connect_complete(shdlc, shdlc->hard_fault);
break;
}
if (shdlc->connect_tries++ < 5) if (shdlc->connect_tries++ < 5)
r = nfc_shdlc_connect_initiate(shdlc); r = nfc_shdlc_connect_initiate(shdlc);
else else
...@@ -610,6 +611,11 @@ static void nfc_shdlc_sm_work(struct work_struct *work) ...@@ -610,6 +611,11 @@ static void nfc_shdlc_sm_work(struct work_struct *work)
} }
nfc_shdlc_handle_rcv_queue(shdlc); nfc_shdlc_handle_rcv_queue(shdlc);
if (shdlc->hard_fault) {
nfc_shdlc_connect_complete(shdlc, shdlc->hard_fault);
break;
}
break; break;
case SHDLC_CONNECTED: case SHDLC_CONNECTED:
nfc_shdlc_handle_rcv_queue(shdlc); nfc_shdlc_handle_rcv_queue(shdlc);
...@@ -637,10 +643,7 @@ static void nfc_shdlc_sm_work(struct work_struct *work) ...@@ -637,10 +643,7 @@ static void nfc_shdlc_sm_work(struct work_struct *work)
} }
if (shdlc->hard_fault) { if (shdlc->hard_fault) {
/* nfc_hci_driver_failure(shdlc->hdev, shdlc->hard_fault);
* TODO: Handle hard_fault that occured during
* this invocation of the shdlc worker
*/
} }
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment