aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/bluetooth/amp.h1
-rw-r--r--net/bluetooth/amp.c14
-rw-r--r--net/bluetooth/l2cap_core.c7
3 files changed, 22 insertions, 0 deletions
diff --git a/include/net/bluetooth/amp.h b/include/net/bluetooth/amp.h
index 405fb9c987e..f1c0017f69e 100644
--- a/include/net/bluetooth/amp.h
+++ b/include/net/bluetooth/amp.h
@@ -47,6 +47,7 @@ void amp_accept_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
47void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle); 47void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle);
48void amp_write_rem_assoc_continue(struct hci_dev *hdev, u8 handle); 48void amp_write_rem_assoc_continue(struct hci_dev *hdev, u8 handle);
49void amp_create_logical_link(struct l2cap_chan *chan); 49void amp_create_logical_link(struct l2cap_chan *chan);
50void amp_disconnect_logical_link(struct hci_chan *hchan);
50void amp_destroy_logical_link(struct hci_chan *hchan, u8 reason); 51void amp_destroy_logical_link(struct hci_chan *hchan, u8 reason);
51 52
52#endif /* __AMP_H */ 53#endif /* __AMP_H */
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 0f3fef34eab..917e034b9aa 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -422,6 +422,20 @@ done:
422 hci_dev_put(hdev); 422 hci_dev_put(hdev);
423} 423}
424 424
425void amp_disconnect_logical_link(struct hci_chan *hchan)
426{
427 struct hci_conn *hcon = hchan->conn;
428 struct hci_cp_disconn_logical_link cp;
429
430 if (hcon->state != BT_CONNECTED) {
431 BT_DBG("hchan %p not connected", hchan);
432 return;
433 }
434
435 cp.log_handle = cpu_to_le16(hchan->handle);
436 hci_send_cmd(hcon->hdev, HCI_OP_DISCONN_LOGICAL_LINK, sizeof(cp), &cp);
437}
438
425void amp_destroy_logical_link(struct hci_chan *hchan, u8 reason) 439void amp_destroy_logical_link(struct hci_chan *hchan, u8 reason)
426{ 440{
427 BT_DBG("hchan %p", hchan); 441 BT_DBG("hchan %p", hchan);
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index ecc5020c924..bb2cd9eaa8a 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -578,6 +578,13 @@ void l2cap_chan_del(struct l2cap_chan *chan, int err)
578 mgr->bredr_chan = NULL; 578 mgr->bredr_chan = NULL;
579 } 579 }
580 580
581 if (chan->hs_hchan) {
582 struct hci_chan *hs_hchan = chan->hs_hchan;
583
584 BT_DBG("chan %p disconnect hs_hchan %p", chan, hs_hchan);
585 amp_disconnect_logical_link(hs_hchan);
586 }
587
581 chan->ops->teardown(chan, err); 588 chan->ops->teardown(chan, err);
582 589
583 if (test_bit(CONF_NOT_COMPLETE, &chan->conf_state)) 590 if (test_bit(CONF_NOT_COMPLETE, &chan->conf_state))