NFC: hci: Change nfc_hci_send_response gate parameter to pipe
authorChristophe Ricard <christophe.ricard@gmail.com>
Tue, 27 Jan 2015 00:18:13 +0000 (01:18 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 27 Jan 2015 22:55:20 +0000 (23:55 +0100)
As there can be several pipes connected to the same gate, we need
to know which pipe ID to use when sending an HCI response. A gate
ID is not enough.

Instead of changing the nfc_hci_send_response() API to something
not aligned with the rest of the HCI API, we call nfc_hci_hcp_message_tx
directly.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
include/net/nfc/hci.h
net/nfc/hci/command.c
net/nfc/hci/core.c

index 5570f4a316d1f124d2b112420a732608938d8b38..1d1fd2b98f1e0f417f6cfaf8dbb7c12db179a775 100644 (file)
@@ -260,8 +260,6 @@ int nfc_hci_send_cmd(struct nfc_hci_dev *hdev, u8 gate, u8 cmd,
 int nfc_hci_send_cmd_async(struct nfc_hci_dev *hdev, u8 gate, u8 cmd,
                           const u8 *param, size_t param_len,
                           data_exchange_cb_t cb, void *cb_context);
-int nfc_hci_send_response(struct nfc_hci_dev *hdev, u8 gate, u8 response,
-                         const u8 *param, size_t param_len);
 int nfc_hci_send_event(struct nfc_hci_dev *hdev, u8 gate, u8 event,
                       const u8 *param, size_t param_len);
 int nfc_hci_target_discovered(struct nfc_hci_dev *hdev, u8 gate);
index 9acf586c98d4b49ad0a7c981ec46f6dfb589f757..844673cb7c18d7c587897453c3e289d06271a0e2 100644 (file)
@@ -116,23 +116,6 @@ int nfc_hci_send_event(struct nfc_hci_dev *hdev, u8 gate, u8 event,
 }
 EXPORT_SYMBOL(nfc_hci_send_event);
 
-int nfc_hci_send_response(struct nfc_hci_dev *hdev, u8 gate, u8 response,
-                         const u8 *param, size_t param_len)
-{
-       u8 pipe;
-
-       pr_debug("\n");
-
-       pipe = hdev->gate2pipe[gate];
-       if (pipe == NFC_HCI_INVALID_PIPE)
-               return -EADDRNOTAVAIL;
-
-       return nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_RESPONSE,
-                                     response, param, param_len, NULL, NULL,
-                                     0);
-}
-EXPORT_SYMBOL(nfc_hci_send_response);
-
 /*
  * Execute an hci command sent to gate.
  * skb will contain response data if success. skb can be NULL if you are not
index 8f8abfed7f650721d6f89b981176734f1c725bf9..e351e94f8d407957487e19f3724b2ddbf2312ea8 100644 (file)
@@ -209,7 +209,8 @@ void nfc_hci_cmd_received(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd,
 
                local_gate = skb->data[3];
                new_pipe = skb->data[4];
-               nfc_hci_send_response(hdev, gate, NFC_HCI_ANY_OK, NULL, 0);
+               nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_RESPONSE,
+                                      NFC_HCI_ANY_OK, NULL, 0, NULL, NULL, 0);
 
                /* save the new created pipe and bind with local gate,
                 * the description for skb->data[3] is destination gate id
@@ -223,11 +224,14 @@ void nfc_hci_cmd_received(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd,
                 * open it
                 */
                if (gate != 0xff)
-                       nfc_hci_send_response(hdev, gate, NFC_HCI_ANY_OK,
-                                             &gate_opened, 1);
+                       nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_RESPONSE,
+                                              NFC_HCI_ANY_OK, &gate_opened, 1,
+                                              NULL, NULL, 0);
                break;
        case NFC_HCI_ADM_NOTIFY_ALL_PIPE_CLEARED:
-               nfc_hci_send_response(hdev, gate, NFC_HCI_ANY_OK, NULL, 0);
+               nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_RESPONSE,
+                                      NFC_HCI_ANY_OK, NULL, 0, NULL, NULL, 0);
+
                break;
        default:
                pr_info("Discarded unknown cmd %x to gate %x\n", cmd, gate);