diff options
author | Eric Lapuyade <eric.lapuyade@linux.intel.com> | 2012-09-11 04:41:41 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-09-24 18:17:25 -0400 |
commit | b5faa648faf974b58e5a79eafa9a97e1deed7a8a (patch) | |
tree | d19b222e6dfb7cc9bfd0df675e583d7e9ec9db8f /net | |
parent | c1be211727467882e0485ab062e712a3c1fba840 (diff) |
NFC: Changed the HCI cmd execution callback prototype
Make it match the data_exchange_cb_t so that it can be used directly in
the implementation of an asynchronous hci_transceive
Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/nfc/hci/command.c | 11 | ||||
-rw-r--r-- | net/nfc/hci/core.c | 15 | ||||
-rw-r--r-- | net/nfc/hci/hci.h | 15 | ||||
-rw-r--r-- | net/nfc/hci/hcp.c | 4 |
4 files changed, 21 insertions, 24 deletions
diff --git a/net/nfc/hci/command.c b/net/nfc/hci/command.c index 46362ef979db..15e21093c7a5 100644 --- a/net/nfc/hci/command.c +++ b/net/nfc/hci/command.c | |||
@@ -28,10 +28,15 @@ | |||
28 | 28 | ||
29 | #include "hci.h" | 29 | #include "hci.h" |
30 | 30 | ||
31 | static void nfc_hci_execute_cb(struct nfc_hci_dev *hdev, int err, | 31 | /* |
32 | struct sk_buff *skb, void *cb_data) | 32 | * HCI command execution completion callback. |
33 | * err will be a standard linux error (may be converted from HCI response) | ||
34 | * skb contains the response data and must be disposed, or may be NULL if | ||
35 | * an error occured | ||
36 | */ | ||
37 | static void nfc_hci_execute_cb(void *context, struct sk_buff *skb, int err) | ||
33 | { | 38 | { |
34 | struct hcp_exec_waiter *hcp_ew = (struct hcp_exec_waiter *)cb_data; | 39 | struct hcp_exec_waiter *hcp_ew = (struct hcp_exec_waiter *)context; |
35 | 40 | ||
36 | pr_debug("HCI Cmd completed with result=%d\n", err); | 41 | pr_debug("HCI Cmd completed with result=%d\n", err); |
37 | 42 | ||
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index 15744c01bddc..e387c86e0cc7 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c | |||
@@ -57,12 +57,11 @@ static void nfc_hci_msg_tx_work(struct work_struct *work) | |||
57 | if (hdev->cmd_pending_msg) { | 57 | if (hdev->cmd_pending_msg) { |
58 | if (timer_pending(&hdev->cmd_timer) == 0) { | 58 | if (timer_pending(&hdev->cmd_timer) == 0) { |
59 | if (hdev->cmd_pending_msg->cb) | 59 | if (hdev->cmd_pending_msg->cb) |
60 | hdev->cmd_pending_msg->cb(hdev, | 60 | hdev->cmd_pending_msg->cb(hdev-> |
61 | -ETIME, | ||
62 | NULL, | ||
63 | hdev-> | ||
64 | cmd_pending_msg-> | 61 | cmd_pending_msg-> |
65 | cb_context); | 62 | cb_context, |
63 | NULL, | ||
64 | -ETIME); | ||
66 | kfree(hdev->cmd_pending_msg); | 65 | kfree(hdev->cmd_pending_msg); |
67 | hdev->cmd_pending_msg = NULL; | 66 | hdev->cmd_pending_msg = NULL; |
68 | } else | 67 | } else |
@@ -83,7 +82,7 @@ next_msg: | |||
83 | kfree_skb(skb); | 82 | kfree_skb(skb); |
84 | skb_queue_purge(&msg->msg_frags); | 83 | skb_queue_purge(&msg->msg_frags); |
85 | if (msg->cb) | 84 | if (msg->cb) |
86 | msg->cb(hdev, r, NULL, msg->cb_context); | 85 | msg->cb(msg->cb_context, NULL, r); |
87 | kfree(msg); | 86 | kfree(msg); |
88 | break; | 87 | break; |
89 | } | 88 | } |
@@ -133,8 +132,8 @@ static void __nfc_hci_cmd_completion(struct nfc_hci_dev *hdev, int err, | |||
133 | del_timer_sync(&hdev->cmd_timer); | 132 | del_timer_sync(&hdev->cmd_timer); |
134 | 133 | ||
135 | if (hdev->cmd_pending_msg->cb) | 134 | if (hdev->cmd_pending_msg->cb) |
136 | hdev->cmd_pending_msg->cb(hdev, err, skb, | 135 | hdev->cmd_pending_msg->cb(hdev->cmd_pending_msg->cb_context, |
137 | hdev->cmd_pending_msg->cb_context); | 136 | skb, err); |
138 | else | 137 | else |
139 | kfree_skb(skb); | 138 | kfree_skb(skb); |
140 | 139 | ||
diff --git a/net/nfc/hci/hci.h b/net/nfc/hci/hci.h index fa9a21e92239..b274d12c18ac 100644 --- a/net/nfc/hci/hci.h +++ b/net/nfc/hci/hci.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #ifndef __LOCAL_HCI_H | 20 | #ifndef __LOCAL_HCI_H |
21 | #define __LOCAL_HCI_H | 21 | #define __LOCAL_HCI_H |
22 | 22 | ||
23 | #include <net/nfc/hci.h> | ||
24 | |||
23 | struct gate_pipe_map { | 25 | struct gate_pipe_map { |
24 | u8 gate; | 26 | u8 gate; |
25 | u8 pipe; | 27 | u8 pipe; |
@@ -35,15 +37,6 @@ struct hcp_packet { | |||
35 | struct hcp_message message; | 37 | struct hcp_message message; |
36 | } __packed; | 38 | } __packed; |
37 | 39 | ||
38 | /* | ||
39 | * HCI command execution completion callback. | ||
40 | * result will be a standard linux error (may be converted from HCI response) | ||
41 | * skb contains the response data and must be disposed, or may be NULL if | ||
42 | * an error occured | ||
43 | */ | ||
44 | typedef void (*hci_cmd_cb_t) (struct nfc_hci_dev *hdev, int result, | ||
45 | struct sk_buff *skb, void *cb_data); | ||
46 | |||
47 | struct hcp_exec_waiter { | 40 | struct hcp_exec_waiter { |
48 | wait_queue_head_t *wq; | 41 | wait_queue_head_t *wq; |
49 | bool exec_complete; | 42 | bool exec_complete; |
@@ -55,7 +48,7 @@ struct hci_msg { | |||
55 | struct list_head msg_l; | 48 | struct list_head msg_l; |
56 | struct sk_buff_head msg_frags; | 49 | struct sk_buff_head msg_frags; |
57 | bool wait_response; | 50 | bool wait_response; |
58 | hci_cmd_cb_t cb; | 51 | data_exchange_cb_t cb; |
59 | void *cb_context; | 52 | void *cb_context; |
60 | unsigned long completion_delay; | 53 | unsigned long completion_delay; |
61 | }; | 54 | }; |
@@ -83,7 +76,7 @@ struct hci_create_pipe_resp { | |||
83 | int nfc_hci_hcp_message_tx(struct nfc_hci_dev *hdev, u8 pipe, | 76 | int nfc_hci_hcp_message_tx(struct nfc_hci_dev *hdev, u8 pipe, |
84 | u8 type, u8 instruction, | 77 | u8 type, u8 instruction, |
85 | const u8 *payload, size_t payload_len, | 78 | const u8 *payload, size_t payload_len, |
86 | hci_cmd_cb_t cb, void *cb_data, | 79 | data_exchange_cb_t cb, void *cb_context, |
87 | unsigned long completion_delay); | 80 | unsigned long completion_delay); |
88 | 81 | ||
89 | u8 nfc_hci_pipe2gate(struct nfc_hci_dev *hdev, u8 pipe); | 82 | u8 nfc_hci_pipe2gate(struct nfc_hci_dev *hdev, u8 pipe); |
diff --git a/net/nfc/hci/hcp.c b/net/nfc/hci/hcp.c index 2372b558abe9..208eedd07ee3 100644 --- a/net/nfc/hci/hcp.c +++ b/net/nfc/hci/hcp.c | |||
@@ -35,7 +35,7 @@ | |||
35 | int nfc_hci_hcp_message_tx(struct nfc_hci_dev *hdev, u8 pipe, | 35 | int nfc_hci_hcp_message_tx(struct nfc_hci_dev *hdev, u8 pipe, |
36 | u8 type, u8 instruction, | 36 | u8 type, u8 instruction, |
37 | const u8 *payload, size_t payload_len, | 37 | const u8 *payload, size_t payload_len, |
38 | hci_cmd_cb_t cb, void *cb_data, | 38 | data_exchange_cb_t cb, void *cb_context, |
39 | unsigned long completion_delay) | 39 | unsigned long completion_delay) |
40 | { | 40 | { |
41 | struct nfc_dev *ndev = hdev->ndev; | 41 | struct nfc_dev *ndev = hdev->ndev; |
@@ -52,7 +52,7 @@ int nfc_hci_hcp_message_tx(struct nfc_hci_dev *hdev, u8 pipe, | |||
52 | skb_queue_head_init(&cmd->msg_frags); | 52 | skb_queue_head_init(&cmd->msg_frags); |
53 | cmd->wait_response = (type == NFC_HCI_HCP_COMMAND) ? true : false; | 53 | cmd->wait_response = (type == NFC_HCI_HCP_COMMAND) ? true : false; |
54 | cmd->cb = cb; | 54 | cmd->cb = cb; |
55 | cmd->cb_context = cb_data; | 55 | cmd->cb_context = cb_context; |
56 | cmd->completion_delay = completion_delay; | 56 | cmd->completion_delay = completion_delay; |
57 | 57 | ||
58 | hci_len = payload_len + 1; | 58 | hci_len = payload_len + 1; |