aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/a2mp.c
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2012-09-27 10:26:24 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-09-27 16:35:09 -0400
commit0b26ab9dce74f8ac77d7eef0d683ab1d527e45b1 (patch)
tree201cc46c4bf0189d649988deb4ad3366f8d30d34 /net/bluetooth/a2mp.c
parentdffa387110025801862d7ad09f4e850d06ff55a9 (diff)
Bluetooth: AMP: Handle Accept phylink command status evt
When receiving HCI Command Status event for Accept Physical Link execute HCI Write Remote AMP Assoc with data saved from A2MP Create Physical Link Request. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth/a2mp.c')
-rw-r--r--net/bluetooth/a2mp.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index dbfdbbb9707c..47565d28b27f 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -438,6 +438,7 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
438 struct a2mp_physlink_rsp rsp; 438 struct a2mp_physlink_rsp rsp;
439 struct hci_dev *hdev; 439 struct hci_dev *hdev;
440 struct hci_conn *hcon; 440 struct hci_conn *hcon;
441 struct amp_ctrl *ctrl;
441 442
442 if (le16_to_cpu(hdr->len) < sizeof(*req)) 443 if (le16_to_cpu(hdr->len) < sizeof(*req))
443 return -EINVAL; 444 return -EINVAL;
@@ -453,6 +454,37 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
453 goto send_rsp; 454 goto send_rsp;
454 } 455 }
455 456
457 ctrl = amp_ctrl_lookup(mgr, rsp.remote_id);
458 if (!ctrl) {
459 ctrl = amp_ctrl_add(mgr);
460 if (ctrl) {
461 amp_ctrl_get(ctrl);
462 } else {
463 rsp.status = A2MP_STATUS_UNABLE_START_LINK_CREATION;
464 goto send_rsp;
465 }
466 }
467
468 if (ctrl) {
469 u8 *assoc, assoc_len = le16_to_cpu(hdr->len) - sizeof(*req);
470
471 ctrl->id = rsp.remote_id;
472
473 assoc = kzalloc(assoc_len, GFP_KERNEL);
474 if (!assoc) {
475 amp_ctrl_put(ctrl);
476 return -ENOMEM;
477 }
478
479 memcpy(assoc, req->amp_assoc, assoc_len);
480 ctrl->assoc = assoc;
481 ctrl->assoc_len = assoc_len;
482 ctrl->assoc_rem_len = assoc_len;
483 ctrl->assoc_len_so_far = 0;
484
485 amp_ctrl_put(ctrl);
486 }
487
456 hcon = phylink_add(hdev, mgr, req->local_id); 488 hcon = phylink_add(hdev, mgr, req->local_id);
457 if (hcon) { 489 if (hcon) {
458 amp_accept_phylink(hdev, mgr, hcon); 490 amp_accept_phylink(hdev, mgr, hcon);