]> Pileus Git - ~andy/linux/blobdiff - net/bluetooth/amp.c
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux...
[~andy/linux] / net / bluetooth / amp.c
index 1b0d92c0643a97595ea2ad44e69f2cf45b96a852..d459ed43c779d776e453634db290d08f48d5a7c7 100644 (file)
@@ -236,7 +236,7 @@ void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr)
 
        cp.max_len = cpu_to_le16(hdev->amp_assoc_size);
 
-       mgr->state = READ_LOC_AMP_ASSOC;
+       set_bit(READ_LOC_AMP_ASSOC, &mgr->state);
        hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_ASSOC, sizeof(cp), &cp);
 }
 
@@ -250,7 +250,7 @@ void amp_read_loc_assoc_final_data(struct hci_dev *hdev,
        cp.len_so_far = cpu_to_le16(0);
        cp.max_len = cpu_to_le16(hdev->amp_assoc_size);
 
-       mgr->state = READ_LOC_AMP_ASSOC_FINAL;
+       set_bit(READ_LOC_AMP_ASSOC_FINAL, &mgr->state);
 
        /* Read Local AMP Assoc final link information data */
        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)
        if (!hcon)
                return;
 
-       amp_write_rem_assoc_frag(hdev, hcon);
+       /* Send A2MP create phylink rsp when all fragments are written */
+       if (amp_write_rem_assoc_frag(hdev, hcon))
+               a2mp_send_create_phy_link_rsp(hdev, 0);
 }
 
 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)
 
 void amp_create_logical_link(struct l2cap_chan *chan)
 {
+       struct hci_conn *hs_hcon = chan->hs_hcon;
        struct hci_cp_create_accept_logical_link cp;
-       struct hci_conn *hcon;
        struct hci_dev *hdev;
 
-       BT_DBG("chan %p", chan);
+       BT_DBG("chan %p hs_hcon %p dst %pMR", chan, hs_hcon, chan->conn->dst);
 
-       if (!chan->hs_hcon)
+       if (!hs_hcon)
                return;
 
        hdev = hci_dev_hold(chan->hs_hcon->hdev);
        if (!hdev)
                return;
 
-       BT_DBG("chan %p dst %pMR", chan, chan->conn->dst);
-
-       hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK, chan->conn->dst);
-       if (!hcon)
-               goto done;
-
-       cp.phy_handle = hcon->handle;
+       cp.phy_handle = hs_hcon->handle;
 
        cp.tx_flow_spec.id = chan->local_id;
        cp.tx_flow_spec.stype = chan->local_stype;
@@ -438,14 +434,13 @@ void amp_create_logical_link(struct l2cap_chan *chan)
        cp.rx_flow_spec.acc_lat = cpu_to_le32(chan->remote_acc_lat);
        cp.rx_flow_spec.flush_to = cpu_to_le32(chan->remote_flush_to);
 
-       if (hcon->out)
+       if (hs_hcon->out)
                hci_send_cmd(hdev, HCI_OP_CREATE_LOGICAL_LINK, sizeof(cp),
                             &cp);
        else
                hci_send_cmd(hdev, HCI_OP_ACCEPT_LOGICAL_LINK, sizeof(cp),
                             &cp);
 
-done:
        hci_dev_put(hdev);
 }