diff options
Diffstat (limited to 'net/bluetooth/amp.c')
-rw-r--r-- | net/bluetooth/amp.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c index 1b0d92c0643a..d459ed43c779 100644 --- a/net/bluetooth/amp.c +++ b/net/bluetooth/amp.c | |||
@@ -236,7 +236,7 @@ void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr) | |||
236 | 236 | ||
237 | cp.max_len = cpu_to_le16(hdev->amp_assoc_size); | 237 | cp.max_len = cpu_to_le16(hdev->amp_assoc_size); |
238 | 238 | ||
239 | mgr->state = READ_LOC_AMP_ASSOC; | 239 | set_bit(READ_LOC_AMP_ASSOC, &mgr->state); |
240 | hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_ASSOC, sizeof(cp), &cp); | 240 | hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_ASSOC, sizeof(cp), &cp); |
241 | } | 241 | } |
242 | 242 | ||
@@ -250,7 +250,7 @@ void amp_read_loc_assoc_final_data(struct hci_dev *hdev, | |||
250 | cp.len_so_far = cpu_to_le16(0); | 250 | cp.len_so_far = cpu_to_le16(0); |
251 | cp.max_len = cpu_to_le16(hdev->amp_assoc_size); | 251 | cp.max_len = cpu_to_le16(hdev->amp_assoc_size); |
252 | 252 | ||
253 | mgr->state = READ_LOC_AMP_ASSOC_FINAL; | 253 | set_bit(READ_LOC_AMP_ASSOC_FINAL, &mgr->state); |
254 | 254 | ||
255 | /* Read Local AMP Assoc final link information data */ | 255 | /* Read Local AMP Assoc final link information data */ |
256 | hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_ASSOC, sizeof(cp), &cp); | 256 | hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_ASSOC, sizeof(cp), &cp); |
@@ -317,7 +317,9 @@ void amp_write_rem_assoc_continue(struct hci_dev *hdev, u8 handle) | |||
317 | if (!hcon) | 317 | if (!hcon) |
318 | return; | 318 | return; |
319 | 319 | ||
320 | amp_write_rem_assoc_frag(hdev, hcon); | 320 | /* Send A2MP create phylink rsp when all fragments are written */ |
321 | if (amp_write_rem_assoc_frag(hdev, hcon)) | ||
322 | a2mp_send_create_phy_link_rsp(hdev, 0); | ||
321 | } | 323 | } |
322 | 324 | ||
323 | void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle) | 325 | void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle) |
@@ -403,26 +405,20 @@ void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon) | |||
403 | 405 | ||
404 | void amp_create_logical_link(struct l2cap_chan *chan) | 406 | void amp_create_logical_link(struct l2cap_chan *chan) |
405 | { | 407 | { |
408 | struct hci_conn *hs_hcon = chan->hs_hcon; | ||
406 | struct hci_cp_create_accept_logical_link cp; | 409 | struct hci_cp_create_accept_logical_link cp; |
407 | struct hci_conn *hcon; | ||
408 | struct hci_dev *hdev; | 410 | struct hci_dev *hdev; |
409 | 411 | ||
410 | BT_DBG("chan %p", chan); | 412 | BT_DBG("chan %p hs_hcon %p dst %pMR", chan, hs_hcon, chan->conn->dst); |
411 | 413 | ||
412 | if (!chan->hs_hcon) | 414 | if (!hs_hcon) |
413 | return; | 415 | return; |
414 | 416 | ||
415 | hdev = hci_dev_hold(chan->hs_hcon->hdev); | 417 | hdev = hci_dev_hold(chan->hs_hcon->hdev); |
416 | if (!hdev) | 418 | if (!hdev) |
417 | return; | 419 | return; |
418 | 420 | ||
419 | BT_DBG("chan %p dst %pMR", chan, chan->conn->dst); | 421 | cp.phy_handle = hs_hcon->handle; |
420 | |||
421 | hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK, chan->conn->dst); | ||
422 | if (!hcon) | ||
423 | goto done; | ||
424 | |||
425 | cp.phy_handle = hcon->handle; | ||
426 | 422 | ||
427 | cp.tx_flow_spec.id = chan->local_id; | 423 | cp.tx_flow_spec.id = chan->local_id; |
428 | cp.tx_flow_spec.stype = chan->local_stype; | 424 | cp.tx_flow_spec.stype = chan->local_stype; |
@@ -438,14 +434,13 @@ void amp_create_logical_link(struct l2cap_chan *chan) | |||
438 | 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); |
439 | 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); |
440 | 436 | ||
441 | if (hcon->out) | 437 | if (hs_hcon->out) |
442 | hci_send_cmd(hdev, HCI_OP_CREATE_LOGICAL_LINK, sizeof(cp), | 438 | hci_send_cmd(hdev, HCI_OP_CREATE_LOGICAL_LINK, sizeof(cp), |
443 | &cp); | 439 | &cp); |
444 | else | 440 | else |
445 | hci_send_cmd(hdev, HCI_OP_ACCEPT_LOGICAL_LINK, sizeof(cp), | 441 | hci_send_cmd(hdev, HCI_OP_ACCEPT_LOGICAL_LINK, sizeof(cp), |
446 | &cp); | 442 | &cp); |
447 | 443 | ||
448 | done: | ||
449 | hci_dev_put(hdev); | 444 | hci_dev_put(hdev); |
450 | } | 445 | } |
451 | 446 | ||