aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/amp.c
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2012-12-07 07:59:06 -0500
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2013-01-09 14:05:05 -0500
commit7a9898c6ff67ad640304fd3d02f9a22874483c3d (patch)
treebf95abd4022f7b8619fefaf306614903bce208c5 /net/bluetooth/amp.c
parent8e05e3ba88adcf7ac644e6ef26676ea7c048a08c (diff)
Bluetooth: AMP: Clean up logical link create / accept
Use chan->hs_hcon instead of lookup by dst address. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth/amp.c')
-rw-r--r--net/bluetooth/amp.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 522865776ec6..6b829b28eb80 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -405,26 +405,20 @@ void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon)
405 405
406void amp_create_logical_link(struct l2cap_chan *chan) 406void amp_create_logical_link(struct l2cap_chan *chan)
407{ 407{
408 struct hci_conn *hs_hcon = chan->hs_hcon;
408 struct hci_cp_create_accept_logical_link cp; 409 struct hci_cp_create_accept_logical_link cp;
409 struct hci_conn *hcon;
410 struct hci_dev *hdev; 410 struct hci_dev *hdev;
411 411
412 BT_DBG("chan %p", chan); 412 BT_DBG("chan %p hs_hcon %p dst %pMR", chan, hs_hcon, chan->conn->dst);
413 413
414 if (!chan->hs_hcon) 414 if (!hs_hcon)
415 return; 415 return;
416 416
417 hdev = hci_dev_hold(chan->hs_hcon->hdev); 417 hdev = hci_dev_hold(chan->hs_hcon->hdev);
418 if (!hdev) 418 if (!hdev)
419 return; 419 return;
420 420
421 BT_DBG("chan %p dst %pMR", chan, chan->conn->dst); 421 cp.phy_handle = hs_hcon->handle;
422
423 hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK, chan->conn->dst);
424 if (!hcon)
425 goto done;
426
427 cp.phy_handle = hcon->handle;
428 422
429 cp.tx_flow_spec.id = chan->local_id; 423 cp.tx_flow_spec.id = chan->local_id;
430 cp.tx_flow_spec.stype = chan->local_stype; 424 cp.tx_flow_spec.stype = chan->local_stype;
@@ -440,14 +434,13 @@ void amp_create_logical_link(struct l2cap_chan *chan)
440 cp.rx_flow_spec.acc_lat = cpu_to_le32(chan->remote_acc_lat); 434 cp.rx_flow_spec.acc_lat = cpu_to_le32(chan->remote_acc_lat);
441 cp.rx_flow_spec.flush_to = cpu_to_le32(chan->remote_flush_to); 435 cp.rx_flow_spec.flush_to = cpu_to_le32(chan->remote_flush_to);
442 436
443 if (hcon->out) 437 if (hs_hcon->out)
444 hci_send_cmd(hdev, HCI_OP_CREATE_LOGICAL_LINK, sizeof(cp), 438 hci_send_cmd(hdev, HCI_OP_CREATE_LOGICAL_LINK, sizeof(cp),
445 &cp); 439 &cp);
446 else 440 else
447 hci_send_cmd(hdev, HCI_OP_ACCEPT_LOGICAL_LINK, sizeof(cp), 441 hci_send_cmd(hdev, HCI_OP_ACCEPT_LOGICAL_LINK, sizeof(cp),
448 &cp); 442 &cp);
449 443
450done:
451 hci_dev_put(hdev); 444 hci_dev_put(hdev);
452} 445}
453 446