diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2015-01-26 19:18:13 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2015-01-27 17:55:20 -0500 |
commit | af77522320aa0e5b4b52dce615ad067d92e15fbf (patch) | |
tree | f0f551759df638ad4a694d176d8cfe2ac6c4ab92 /net/nfc | |
parent | 118278f20aa89efe45fa1e2b1829f198d557f8fe (diff) |
NFC: hci: Change nfc_hci_send_response gate parameter to pipe
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>
Diffstat (limited to 'net/nfc')
-rw-r--r-- | net/nfc/hci/command.c | 17 | ||||
-rw-r--r-- | net/nfc/hci/core.c | 12 |
2 files changed, 8 insertions, 21 deletions
diff --git a/net/nfc/hci/command.c b/net/nfc/hci/command.c index 9acf586c98d4..844673cb7c18 100644 --- a/net/nfc/hci/command.c +++ b/net/nfc/hci/command.c | |||
@@ -116,23 +116,6 @@ int nfc_hci_send_event(struct nfc_hci_dev *hdev, u8 gate, u8 event, | |||
116 | } | 116 | } |
117 | EXPORT_SYMBOL(nfc_hci_send_event); | 117 | EXPORT_SYMBOL(nfc_hci_send_event); |
118 | 118 | ||
119 | int nfc_hci_send_response(struct nfc_hci_dev *hdev, u8 gate, u8 response, | ||
120 | const u8 *param, size_t param_len) | ||
121 | { | ||
122 | u8 pipe; | ||
123 | |||
124 | pr_debug("\n"); | ||
125 | |||
126 | pipe = hdev->gate2pipe[gate]; | ||
127 | if (pipe == NFC_HCI_INVALID_PIPE) | ||
128 | return -EADDRNOTAVAIL; | ||
129 | |||
130 | return nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_RESPONSE, | ||
131 | response, param, param_len, NULL, NULL, | ||
132 | 0); | ||
133 | } | ||
134 | EXPORT_SYMBOL(nfc_hci_send_response); | ||
135 | |||
136 | /* | 119 | /* |
137 | * Execute an hci command sent to gate. | 120 | * Execute an hci command sent to gate. |
138 | * skb will contain response data if success. skb can be NULL if you are not | 121 | * skb will contain response data if success. skb can be NULL if you are not |
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index 8f8abfed7f65..e351e94f8d40 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c | |||
@@ -209,7 +209,8 @@ void nfc_hci_cmd_received(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd, | |||
209 | 209 | ||
210 | local_gate = skb->data[3]; | 210 | local_gate = skb->data[3]; |
211 | new_pipe = skb->data[4]; | 211 | new_pipe = skb->data[4]; |
212 | nfc_hci_send_response(hdev, gate, NFC_HCI_ANY_OK, NULL, 0); | 212 | nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_RESPONSE, |
213 | NFC_HCI_ANY_OK, NULL, 0, NULL, NULL, 0); | ||
213 | 214 | ||
214 | /* save the new created pipe and bind with local gate, | 215 | /* save the new created pipe and bind with local gate, |
215 | * the description for skb->data[3] is destination gate id | 216 | * 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, | |||
223 | * open it | 224 | * open it |
224 | */ | 225 | */ |
225 | if (gate != 0xff) | 226 | if (gate != 0xff) |
226 | nfc_hci_send_response(hdev, gate, NFC_HCI_ANY_OK, | 227 | nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_RESPONSE, |
227 | &gate_opened, 1); | 228 | NFC_HCI_ANY_OK, &gate_opened, 1, |
229 | NULL, NULL, 0); | ||
228 | break; | 230 | break; |
229 | case NFC_HCI_ADM_NOTIFY_ALL_PIPE_CLEARED: | 231 | case NFC_HCI_ADM_NOTIFY_ALL_PIPE_CLEARED: |
230 | nfc_hci_send_response(hdev, gate, NFC_HCI_ANY_OK, NULL, 0); | 232 | nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_RESPONSE, |
233 | NFC_HCI_ANY_OK, NULL, 0, NULL, NULL, 0); | ||
234 | |||
231 | break; | 235 | break; |
232 | default: | 236 | default: |
233 | pr_info("Discarded unknown cmd %x to gate %x\n", cmd, gate); | 237 | pr_info("Discarded unknown cmd %x to gate %x\n", cmd, gate); |