aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/bluetooth/a2mp.c34
-rw-r--r--net/bluetooth/a2mp.h1
2 files changed, 17 insertions, 18 deletions
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index e4f179117ae2..6bba3044dc7f 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -77,6 +77,23 @@ u8 __next_ident(struct amp_mgr *mgr)
77 return mgr->ident; 77 return mgr->ident;
78} 78}
79 79
80static struct amp_mgr *amp_mgr_lookup_by_state(u8 state)
81{
82 struct amp_mgr *mgr;
83
84 mutex_lock(&amp_mgr_list_lock);
85 list_for_each_entry(mgr, &amp_mgr_list, list) {
86 if (test_and_clear_bit(state, &mgr->state)) {
87 amp_mgr_get(mgr);
88 mutex_unlock(&amp_mgr_list_lock);
89 return mgr;
90 }
91 }
92 mutex_unlock(&amp_mgr_list_lock);
93
94 return NULL;
95}
96
80/* hci_dev_list shall be locked */ 97/* hci_dev_list shall be locked */
81static void __a2mp_add_cl(struct amp_mgr *mgr, struct a2mp_cl *cl) 98static void __a2mp_add_cl(struct amp_mgr *mgr, struct a2mp_cl *cl)
82{ 99{
@@ -862,23 +879,6 @@ struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
862 return mgr->a2mp_chan; 879 return mgr->a2mp_chan;
863} 880}
864 881
865struct amp_mgr *amp_mgr_lookup_by_state(u8 state)
866{
867 struct amp_mgr *mgr;
868
869 mutex_lock(&amp_mgr_list_lock);
870 list_for_each_entry(mgr, &amp_mgr_list, list) {
871 if (test_and_clear_bit(state, &mgr->state)) {
872 amp_mgr_get(mgr);
873 mutex_unlock(&amp_mgr_list_lock);
874 return mgr;
875 }
876 }
877 mutex_unlock(&amp_mgr_list_lock);
878
879 return NULL;
880}
881
882void a2mp_send_getinfo_rsp(struct hci_dev *hdev) 882void a2mp_send_getinfo_rsp(struct hci_dev *hdev)
883{ 883{
884 struct amp_mgr *mgr; 884 struct amp_mgr *mgr;
diff --git a/net/bluetooth/a2mp.h b/net/bluetooth/a2mp.h
index 883266602cbc..652117ebf2a5 100644
--- a/net/bluetooth/a2mp.h
+++ b/net/bluetooth/a2mp.h
@@ -134,7 +134,6 @@ int amp_mgr_put(struct amp_mgr *mgr);
134u8 __next_ident(struct amp_mgr *mgr); 134u8 __next_ident(struct amp_mgr *mgr);
135struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn, 135struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
136 struct sk_buff *skb); 136 struct sk_buff *skb);
137struct amp_mgr *amp_mgr_lookup_by_state(u8 state);
138void a2mp_send(struct amp_mgr *mgr, u8 code, u8 ident, u16 len, void *data); 137void a2mp_send(struct amp_mgr *mgr, u8 code, u8 ident, u16 len, void *data);
139void a2mp_discover_amp(struct l2cap_chan *chan); 138void a2mp_discover_amp(struct l2cap_chan *chan);
140void a2mp_send_getinfo_rsp(struct hci_dev *hdev); 139void a2mp_send_getinfo_rsp(struct hci_dev *hdev);