diff options
author | Arron Wang <arron.wang@intel.com> | 2015-07-24 05:11:01 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-07-30 07:37:22 -0400 |
commit | df9b89c7e46cf88ebf5a29c28c45d3b0b8c5d502 (patch) | |
tree | 39c6dd056a3f20c83dfd2be10f2aa1fbe266c8d4 /net/bluetooth/amp.c | |
parent | b3d3914006a05cae448684058760359ef0cded49 (diff) |
Bluetooth: Move create/accept phy link completed callback to amp.c
To avoid amp module hooks from hci_event.c
Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/amp.c')
-rw-r--r-- | net/bluetooth/amp.c | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c index 45888fad8362..238ddd3cf95f 100644 --- a/net/bluetooth/amp.c +++ b/net/bluetooth/amp.c | |||
@@ -417,10 +417,37 @@ void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle) | |||
417 | amp_write_rem_assoc_frag(hdev, hcon); | 417 | amp_write_rem_assoc_frag(hdev, hcon); |
418 | } | 418 | } |
419 | 419 | ||
420 | static void create_phylink_complete(struct hci_dev *hdev, u8 status, | ||
421 | u16 opcode) | ||
422 | { | ||
423 | struct hci_cp_create_phy_link *cp; | ||
424 | |||
425 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | ||
426 | |||
427 | cp = hci_sent_cmd_data(hdev, HCI_OP_CREATE_PHY_LINK); | ||
428 | if (!cp) | ||
429 | return; | ||
430 | |||
431 | hci_dev_lock(hdev); | ||
432 | |||
433 | if (status) { | ||
434 | struct hci_conn *hcon; | ||
435 | |||
436 | hcon = hci_conn_hash_lookup_handle(hdev, cp->phy_handle); | ||
437 | if (hcon) | ||
438 | hci_conn_del(hcon); | ||
439 | } else { | ||
440 | amp_write_remote_assoc(hdev, cp->phy_handle); | ||
441 | } | ||
442 | |||
443 | hci_dev_unlock(hdev); | ||
444 | } | ||
445 | |||
420 | void amp_create_phylink(struct hci_dev *hdev, struct amp_mgr *mgr, | 446 | void amp_create_phylink(struct hci_dev *hdev, struct amp_mgr *mgr, |
421 | struct hci_conn *hcon) | 447 | struct hci_conn *hcon) |
422 | { | 448 | { |
423 | struct hci_cp_create_phy_link cp; | 449 | struct hci_cp_create_phy_link cp; |
450 | struct hci_request req; | ||
424 | 451 | ||
425 | cp.phy_handle = hcon->handle; | 452 | cp.phy_handle = hcon->handle; |
426 | 453 | ||
@@ -433,13 +460,33 @@ void amp_create_phylink(struct hci_dev *hdev, struct amp_mgr *mgr, | |||
433 | return; | 460 | return; |
434 | } | 461 | } |
435 | 462 | ||
436 | hci_send_cmd(hdev, HCI_OP_CREATE_PHY_LINK, sizeof(cp), &cp); | 463 | hci_req_init(&req, hdev); |
464 | hci_req_add(&req, HCI_OP_CREATE_PHY_LINK, sizeof(cp), &cp); | ||
465 | hci_req_run(&req, create_phylink_complete); | ||
466 | } | ||
467 | |||
468 | static void accept_phylink_complete(struct hci_dev *hdev, u8 status, | ||
469 | u16 opcode) | ||
470 | { | ||
471 | struct hci_cp_accept_phy_link *cp; | ||
472 | |||
473 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | ||
474 | |||
475 | if (status) | ||
476 | return; | ||
477 | |||
478 | cp = hci_sent_cmd_data(hdev, HCI_OP_ACCEPT_PHY_LINK); | ||
479 | if (!cp) | ||
480 | return; | ||
481 | |||
482 | amp_write_remote_assoc(hdev, cp->phy_handle); | ||
437 | } | 483 | } |
438 | 484 | ||
439 | void amp_accept_phylink(struct hci_dev *hdev, struct amp_mgr *mgr, | 485 | void amp_accept_phylink(struct hci_dev *hdev, struct amp_mgr *mgr, |
440 | struct hci_conn *hcon) | 486 | struct hci_conn *hcon) |
441 | { | 487 | { |
442 | struct hci_cp_accept_phy_link cp; | 488 | struct hci_cp_accept_phy_link cp; |
489 | struct hci_request req; | ||
443 | 490 | ||
444 | cp.phy_handle = hcon->handle; | 491 | cp.phy_handle = hcon->handle; |
445 | 492 | ||
@@ -452,7 +499,9 @@ void amp_accept_phylink(struct hci_dev *hdev, struct amp_mgr *mgr, | |||
452 | return; | 499 | return; |
453 | } | 500 | } |
454 | 501 | ||
455 | hci_send_cmd(hdev, HCI_OP_ACCEPT_PHY_LINK, sizeof(cp), &cp); | 502 | hci_req_init(&req, hdev); |
503 | hci_req_add(&req, HCI_OP_ACCEPT_PHY_LINK, sizeof(cp), &cp); | ||
504 | hci_req_run(&req, accept_phylink_complete); | ||
456 | } | 505 | } |
457 | 506 | ||
458 | void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon) | 507 | void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon) |