Bluetooth: AMP: Get amp_mgr reference in HS hci_conn
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>
Thu, 18 Oct 2012 10:16:19 +0000 (13:16 +0300)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Thu, 18 Oct 2012 10:27:20 +0000 (07:27 -0300)
When assigning amp_mgr in hci_conn (type AMP_LINK) get also reference.
In hci_conn_del those references would be put for both conn types
AMP_LINK and ACL_LINK associated with amp_mgr.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
include/net/bluetooth/a2mp.h
net/bluetooth/a2mp.c
net/bluetooth/amp.c

index e776ab2dc572d12551534a14a5a21e1fe3f167fa..42f21766c538b4bfeab6d140aaaa0fcada8e1f16 100644 (file)
@@ -133,7 +133,7 @@ struct a2mp_physlink_rsp {
 extern struct list_head amp_mgr_list;
 extern struct mutex amp_mgr_list_lock;
 
-void amp_mgr_get(struct amp_mgr *mgr);
+struct amp_mgr *amp_mgr_get(struct amp_mgr *mgr);
 int amp_mgr_put(struct amp_mgr *mgr);
 u8 __next_ident(struct amp_mgr *mgr);
 struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
index 7bf9a10d8e4605e327341b7e4ab65fe0fcb1ecfe..d5136cfb57e2e33276b93947d7b64aa3b4d98fa8 100644 (file)
@@ -751,11 +751,13 @@ static struct l2cap_chan *a2mp_chan_open(struct l2cap_conn *conn, bool locked)
 }
 
 /* AMP Manager functions */
-void amp_mgr_get(struct amp_mgr *mgr)
+struct amp_mgr *amp_mgr_get(struct amp_mgr *mgr)
 {
        BT_DBG("mgr %p orig refcnt %d", mgr, atomic_read(&mgr->kref.refcount));
 
        kref_get(&mgr->kref);
+
+       return mgr;
 }
 
 static void amp_mgr_destroy(struct kref *kref)
index 59da0f15818e64844d7bfa8c1d22266d8a5bc316..231d7ef53ecb8a7461b44d3ca52b3eff4ee18739 100644 (file)
@@ -123,7 +123,7 @@ struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
        hcon->attempt++;
        hcon->handle = __next_handle(mgr);
        hcon->remote_id = remote_id;
-       hcon->amp_mgr = mgr;
+       hcon->amp_mgr = amp_mgr_get(mgr);
        hcon->out = out;
 
        return hcon;
This page took 0.027073 seconds and 5 git commands to generate.