diff options
author | Arron Wang <arron.wang@intel.com> | 2015-07-24 05:10:16 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-07-30 07:37:22 -0400 |
commit | 839278823c27b71b46d677c8cf56b2d1f95610af (patch) | |
tree | 6a945f5e0402ce3207a7f886a5aa7dac52c71e76 | |
parent | a77a6a14e54a6853141d99512bfed4acb5c2657a (diff) |
Bluetooth: Move get info completed callback to a2mp.c
To avoid a2mp module hooks from hci_event.c and send
getinfo response operation only required by a2mp module,
we can move this callback to a2mp.c
Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | net/bluetooth/a2mp.c | 17 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 5 |
2 files changed, 17 insertions, 5 deletions
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c index 5a04eb1a7e57..5f123c3320a7 100644 --- a/net/bluetooth/a2mp.c +++ b/net/bluetooth/a2mp.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <net/bluetooth/hci_core.h> | 16 | #include <net/bluetooth/hci_core.h> |
17 | #include <net/bluetooth/l2cap.h> | 17 | #include <net/bluetooth/l2cap.h> |
18 | 18 | ||
19 | #include "hci_request.h" | ||
19 | #include "a2mp.h" | 20 | #include "a2mp.h" |
20 | #include "amp.h" | 21 | #include "amp.h" |
21 | 22 | ||
@@ -286,11 +287,21 @@ static int a2mp_change_notify(struct amp_mgr *mgr, struct sk_buff *skb, | |||
286 | return 0; | 287 | return 0; |
287 | } | 288 | } |
288 | 289 | ||
290 | static void read_local_amp_info_complete(struct hci_dev *hdev, u8 status, | ||
291 | u16 opcode) | ||
292 | { | ||
293 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | ||
294 | |||
295 | a2mp_send_getinfo_rsp(hdev); | ||
296 | } | ||
297 | |||
289 | static int a2mp_getinfo_req(struct amp_mgr *mgr, struct sk_buff *skb, | 298 | static int a2mp_getinfo_req(struct amp_mgr *mgr, struct sk_buff *skb, |
290 | struct a2mp_cmd *hdr) | 299 | struct a2mp_cmd *hdr) |
291 | { | 300 | { |
292 | struct a2mp_info_req *req = (void *) skb->data; | 301 | struct a2mp_info_req *req = (void *) skb->data; |
293 | struct hci_dev *hdev; | 302 | struct hci_dev *hdev; |
303 | struct hci_request hreq; | ||
304 | int err = 0; | ||
294 | 305 | ||
295 | if (le16_to_cpu(hdr->len) < sizeof(*req)) | 306 | if (le16_to_cpu(hdr->len) < sizeof(*req)) |
296 | return -EINVAL; | 307 | return -EINVAL; |
@@ -311,7 +322,11 @@ static int a2mp_getinfo_req(struct amp_mgr *mgr, struct sk_buff *skb, | |||
311 | } | 322 | } |
312 | 323 | ||
313 | set_bit(READ_LOC_AMP_INFO, &mgr->state); | 324 | set_bit(READ_LOC_AMP_INFO, &mgr->state); |
314 | hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_INFO, 0, NULL); | 325 | hci_req_init(&hreq, hdev); |
326 | hci_req_add(&hreq, HCI_OP_READ_LOCAL_AMP_INFO, 0, NULL); | ||
327 | err = hci_req_run(&hreq, read_local_amp_info_complete); | ||
328 | if (err < 0) | ||
329 | a2mp_send_getinfo_rsp(hdev); | ||
315 | 330 | ||
316 | done: | 331 | done: |
317 | if (hdev) | 332 | if (hdev) |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 4f0a97b94837..a9a8e453817e 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -823,7 +823,7 @@ static void hci_cc_read_local_amp_info(struct hci_dev *hdev, | |||
823 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); | 823 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); |
824 | 824 | ||
825 | if (rp->status) | 825 | if (rp->status) |
826 | goto a2mp_rsp; | 826 | return; |
827 | 827 | ||
828 | hdev->amp_status = rp->amp_status; | 828 | hdev->amp_status = rp->amp_status; |
829 | hdev->amp_total_bw = __le32_to_cpu(rp->total_bw); | 829 | hdev->amp_total_bw = __le32_to_cpu(rp->total_bw); |
@@ -835,9 +835,6 @@ static void hci_cc_read_local_amp_info(struct hci_dev *hdev, | |||
835 | hdev->amp_assoc_size = __le16_to_cpu(rp->max_assoc_size); | 835 | hdev->amp_assoc_size = __le16_to_cpu(rp->max_assoc_size); |
836 | hdev->amp_be_flush_to = __le32_to_cpu(rp->be_flush_to); | 836 | hdev->amp_be_flush_to = __le32_to_cpu(rp->be_flush_to); |
837 | hdev->amp_max_flush_to = __le32_to_cpu(rp->max_flush_to); | 837 | hdev->amp_max_flush_to = __le32_to_cpu(rp->max_flush_to); |
838 | |||
839 | a2mp_rsp: | ||
840 | a2mp_send_getinfo_rsp(hdev); | ||
841 | } | 838 | } |
842 | 839 | ||
843 | static void hci_cc_read_local_amp_assoc(struct hci_dev *hdev, | 840 | static void hci_cc_read_local_amp_assoc(struct hci_dev *hdev, |