• Home
  • Raw
  • Download

Lines Matching refs:mgr

46 void a2mp_send(struct amp_mgr *mgr, u8 code, u8 ident, u16 len, void *data)  in a2mp_send()  argument
48 struct l2cap_chan *chan = mgr->a2mp_chan; in a2mp_send()
71 u8 __next_ident(struct amp_mgr *mgr) in __next_ident() argument
73 if (++mgr->ident == 0) in __next_ident()
74 mgr->ident = 1; in __next_ident()
76 return mgr->ident; in __next_ident()
80 static void __a2mp_add_cl(struct amp_mgr *mgr, struct a2mp_cl *cl) in __a2mp_add_cl() argument
103 static int a2mp_command_rej(struct amp_mgr *mgr, struct sk_buff *skb, in a2mp_command_rej() argument
118 static int a2mp_discover_req(struct amp_mgr *mgr, struct sk_buff *skb, in a2mp_discover_req() argument
168 __a2mp_add_cl(mgr, rsp->cl); in a2mp_discover_req()
172 a2mp_send(mgr, A2MP_DISCOVER_RSP, hdr->ident, len, rsp); in a2mp_discover_req()
178 static int a2mp_discover_rsp(struct amp_mgr *mgr, struct sk_buff *skb, in a2mp_discover_rsp() argument
218 a2mp_send(mgr, A2MP_GETINFO_REQ, __next_ident(mgr), in a2mp_discover_rsp()
228 struct l2cap_conn *conn = mgr->l2cap_conn; in a2mp_discover_rsp()
255 static int a2mp_change_notify(struct amp_mgr *mgr, struct sk_buff *skb, in a2mp_change_notify() argument
271 static int a2mp_getinfo_req(struct amp_mgr *mgr, struct sk_buff *skb, in a2mp_getinfo_req() argument
289 a2mp_send(mgr, A2MP_GETINFO_RSP, hdr->ident, sizeof(rsp), in a2mp_getinfo_req()
295 set_bit(READ_LOC_AMP_INFO, &mgr->state); in a2mp_getinfo_req()
306 static int a2mp_getinfo_rsp(struct amp_mgr *mgr, struct sk_buff *skb, in a2mp_getinfo_rsp() argument
321 ctrl = amp_ctrl_add(mgr, rsp->id); in a2mp_getinfo_rsp()
326 a2mp_send(mgr, A2MP_GETAMPASSOC_REQ, __next_ident(mgr), sizeof(req), in a2mp_getinfo_rsp()
333 static int a2mp_getampassoc_req(struct amp_mgr *mgr, struct sk_buff *skb, in a2mp_getampassoc_req() argument
360 a2mp_send(mgr, A2MP_GETAMPASSOC_RSP, hdr->ident, sizeof(rsp), in a2mp_getampassoc_req()
366 amp_read_loc_assoc(hdev, mgr); in a2mp_getampassoc_req()
376 static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb, in a2mp_getampassoc_rsp() argument
398 ctrl = amp_ctrl_lookup(mgr, rsp->id); in a2mp_getampassoc_rsp()
421 hcon = phylink_add(hdev, mgr, rsp->id, true); in a2mp_getampassoc_rsp()
427 mgr->bredr_chan->remote_amp_id = rsp->id; in a2mp_getampassoc_rsp()
429 amp_create_phylink(hdev, mgr, hcon); in a2mp_getampassoc_rsp()
437 static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb, in a2mp_createphyslink_req() argument
461 ctrl = amp_ctrl_lookup(mgr, rsp.remote_id); in a2mp_createphyslink_req()
463 ctrl = amp_ctrl_add(mgr, rsp.remote_id); in a2mp_createphyslink_req()
490 hcon = phylink_add(hdev, mgr, req->local_id, false); in a2mp_createphyslink_req()
492 amp_accept_phylink(hdev, mgr, hcon); in a2mp_createphyslink_req()
506 a2mp_send(mgr, A2MP_CREATEPHYSLINK_RSP, hdr->ident, in a2mp_createphyslink_req()
509 set_bit(WRITE_REMOTE_AMP_ASSOC, &mgr->state); in a2mp_createphyslink_req()
510 mgr->ident = hdr->ident; in a2mp_createphyslink_req()
517 static int a2mp_discphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb, in a2mp_discphyslink_req() argument
541 &mgr->l2cap_conn->hcon->dst); in a2mp_discphyslink_req()
554 a2mp_send(mgr, A2MP_DISCONNPHYSLINK_RSP, hdr->ident, sizeof(rsp), &rsp); in a2mp_discphyslink_req()
560 static inline int a2mp_cmd_rsp(struct amp_mgr *mgr, struct sk_buff *skb, in a2mp_cmd_rsp() argument
573 struct amp_mgr *mgr = chan->data; in a2mp_chan_recv_cb() local
576 amp_mgr_get(mgr); in a2mp_chan_recv_cb()
593 mgr->ident = hdr->ident; in a2mp_chan_recv_cb()
597 a2mp_command_rej(mgr, skb, hdr); in a2mp_chan_recv_cb()
601 err = a2mp_discover_req(mgr, skb, hdr); in a2mp_chan_recv_cb()
605 err = a2mp_change_notify(mgr, skb, hdr); in a2mp_chan_recv_cb()
609 err = a2mp_getinfo_req(mgr, skb, hdr); in a2mp_chan_recv_cb()
613 err = a2mp_getampassoc_req(mgr, skb, hdr); in a2mp_chan_recv_cb()
617 err = a2mp_createphyslink_req(mgr, skb, hdr); in a2mp_chan_recv_cb()
621 err = a2mp_discphyslink_req(mgr, skb, hdr); in a2mp_chan_recv_cb()
625 err = a2mp_discover_rsp(mgr, skb, hdr); in a2mp_chan_recv_cb()
629 err = a2mp_getinfo_rsp(mgr, skb, hdr); in a2mp_chan_recv_cb()
633 err = a2mp_getampassoc_rsp(mgr, skb, hdr); in a2mp_chan_recv_cb()
639 err = a2mp_cmd_rsp(mgr, skb, hdr); in a2mp_chan_recv_cb()
657 a2mp_send(mgr, A2MP_COMMAND_REJ, hdr->ident, sizeof(rej), in a2mp_chan_recv_cb()
665 amp_mgr_put(mgr); in a2mp_chan_recv_cb()
678 struct amp_mgr *mgr = chan->data; in a2mp_chan_state_change_cb() local
680 if (!mgr) in a2mp_chan_state_change_cb()
689 if (mgr) in a2mp_chan_state_change_cb()
690 amp_mgr_put(mgr); in a2mp_chan_state_change_cb()
779 struct amp_mgr *amp_mgr_get(struct amp_mgr *mgr) in amp_mgr_get() argument
781 BT_DBG("mgr %p orig refcnt %d", mgr, atomic_read(&mgr->kref.refcount)); in amp_mgr_get()
783 kref_get(&mgr->kref); in amp_mgr_get()
785 return mgr; in amp_mgr_get()
790 struct amp_mgr *mgr = container_of(kref, struct amp_mgr, kref); in amp_mgr_destroy() local
792 BT_DBG("mgr %p", mgr); in amp_mgr_destroy()
795 list_del(&mgr->list); in amp_mgr_destroy()
798 amp_ctrl_list_flush(mgr); in amp_mgr_destroy()
799 kfree(mgr); in amp_mgr_destroy()
802 int amp_mgr_put(struct amp_mgr *mgr) in amp_mgr_put() argument
804 BT_DBG("mgr %p orig refcnt %d", mgr, atomic_read(&mgr->kref.refcount)); in amp_mgr_put()
806 return kref_put(&mgr->kref, &amp_mgr_destroy); in amp_mgr_put()
811 struct amp_mgr *mgr; in amp_mgr_create() local
814 mgr = kzalloc(sizeof(*mgr), GFP_KERNEL); in amp_mgr_create()
815 if (!mgr) in amp_mgr_create()
818 BT_DBG("conn %p mgr %p", conn, mgr); in amp_mgr_create()
820 mgr->l2cap_conn = conn; in amp_mgr_create()
824 kfree(mgr); in amp_mgr_create()
828 mgr->a2mp_chan = chan; in amp_mgr_create()
829 chan->data = mgr; in amp_mgr_create()
831 conn->hcon->amp_mgr = mgr; in amp_mgr_create()
833 kref_init(&mgr->kref); in amp_mgr_create()
836 INIT_LIST_HEAD(&mgr->amp_ctrls); in amp_mgr_create()
837 mutex_init(&mgr->amp_ctrls_lock); in amp_mgr_create()
840 list_add(&mgr->list, &amp_mgr_list); in amp_mgr_create()
843 return mgr; in amp_mgr_create()
849 struct amp_mgr *mgr; in a2mp_channel_create() local
854 mgr = amp_mgr_create(conn, false); in a2mp_channel_create()
855 if (!mgr) { in a2mp_channel_create()
860 BT_DBG("mgr: %p chan %p", mgr, mgr->a2mp_chan); in a2mp_channel_create()
862 return mgr->a2mp_chan; in a2mp_channel_create()
867 struct amp_mgr *mgr; in amp_mgr_lookup_by_state() local
870 list_for_each_entry(mgr, &amp_mgr_list, list) { in amp_mgr_lookup_by_state()
871 if (test_and_clear_bit(state, &mgr->state)) { in amp_mgr_lookup_by_state()
872 amp_mgr_get(mgr); in amp_mgr_lookup_by_state()
874 return mgr; in amp_mgr_lookup_by_state()
884 struct amp_mgr *mgr; in a2mp_send_getinfo_rsp() local
887 mgr = amp_mgr_lookup_by_state(READ_LOC_AMP_INFO); in a2mp_send_getinfo_rsp()
888 if (!mgr) in a2mp_send_getinfo_rsp()
891 BT_DBG("%s mgr %p", hdev->name, mgr); in a2mp_send_getinfo_rsp()
905 a2mp_send(mgr, A2MP_GETINFO_RSP, mgr->ident, sizeof(rsp), &rsp); in a2mp_send_getinfo_rsp()
906 amp_mgr_put(mgr); in a2mp_send_getinfo_rsp()
911 struct amp_mgr *mgr; in a2mp_send_getampassoc_rsp() local
916 mgr = amp_mgr_lookup_by_state(READ_LOC_AMP_ASSOC); in a2mp_send_getampassoc_rsp()
917 if (!mgr) in a2mp_send_getampassoc_rsp()
920 BT_DBG("%s mgr %p", hdev->name, mgr); in a2mp_send_getampassoc_rsp()
925 amp_mgr_put(mgr); in a2mp_send_getampassoc_rsp()
938 a2mp_send(mgr, A2MP_GETAMPASSOC_RSP, mgr->ident, len, rsp); in a2mp_send_getampassoc_rsp()
939 amp_mgr_put(mgr); in a2mp_send_getampassoc_rsp()
945 struct amp_mgr *mgr; in a2mp_send_create_phy_link_req() local
951 mgr = amp_mgr_lookup_by_state(READ_LOC_AMP_ASSOC_FINAL); in a2mp_send_create_phy_link_req()
952 if (!mgr) in a2mp_send_create_phy_link_req()
957 BT_DBG("%s mgr %p assoc_len %zu", hdev->name, mgr, len); in a2mp_send_create_phy_link_req()
961 amp_mgr_put(mgr); in a2mp_send_create_phy_link_req()
965 bredr_chan = mgr->bredr_chan; in a2mp_send_create_phy_link_req()
973 a2mp_send(mgr, A2MP_CREATEPHYSLINK_REQ, __next_ident(mgr), len, req); in a2mp_send_create_phy_link_req()
976 amp_mgr_put(mgr); in a2mp_send_create_phy_link_req()
982 struct amp_mgr *mgr; in a2mp_send_create_phy_link_rsp() local
986 mgr = amp_mgr_lookup_by_state(WRITE_REMOTE_AMP_ASSOC); in a2mp_send_create_phy_link_rsp()
987 if (!mgr) in a2mp_send_create_phy_link_rsp()
998 BT_DBG("%s mgr %p hs_hcon %p status %u", hdev->name, mgr, hs_hcon, in a2mp_send_create_phy_link_rsp()
1002 a2mp_send(mgr, A2MP_CREATEPHYSLINK_RSP, mgr->ident, sizeof(rsp), &rsp); in a2mp_send_create_phy_link_rsp()
1003 amp_mgr_put(mgr); in a2mp_send_create_phy_link_rsp()
1009 struct amp_mgr *mgr = conn->hcon->amp_mgr; in a2mp_discover_amp() local
1012 BT_DBG("chan %p conn %p mgr %p", chan, conn, mgr); in a2mp_discover_amp()
1014 if (!mgr) { in a2mp_discover_amp()
1015 mgr = amp_mgr_create(conn, true); in a2mp_discover_amp()
1016 if (!mgr) in a2mp_discover_amp()
1020 mgr->bredr_chan = chan; in a2mp_discover_amp()
1024 a2mp_send(mgr, A2MP_DISCOVER_REQ, 1, sizeof(req), &req); in a2mp_discover_amp()