aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/amp.c
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2012-10-05 09:56:55 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-10-07 18:19:04 -0400
commitfa4ebc66c432d0e0ec947cb754d4144c4a681f28 (patch)
treece31c236f663a249276883413f19dba534569738 /net/bluetooth/amp.c
parent85e34368dea6fc8a2d16464e01c85d3b7bd682bd (diff)
Bluetooth: AMP: Factor out amp_ctrl_add
Add ctrl_id parameter to amp_ctrl_add since we always set it after function ctrl is created. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth/amp.c')
-rw-r--r--net/bluetooth/amp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index b6e1c3ac74f1..2fc5562a84b9 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -45,7 +45,7 @@ int amp_ctrl_put(struct amp_ctrl *ctrl)
45 return kref_put(&ctrl->kref, &amp_ctrl_destroy); 45 return kref_put(&ctrl->kref, &amp_ctrl_destroy);
46} 46}
47 47
48struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr) 48struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr, u8 id)
49{ 49{
50 struct amp_ctrl *ctrl; 50 struct amp_ctrl *ctrl;
51 51
@@ -53,12 +53,13 @@ struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr)
53 if (!ctrl) 53 if (!ctrl)
54 return NULL; 54 return NULL;
55 55
56 kref_init(&ctrl->kref);
57 ctrl->id = id;
58
56 mutex_lock(&mgr->amp_ctrls_lock); 59 mutex_lock(&mgr->amp_ctrls_lock);
57 list_add(&ctrl->list, &mgr->amp_ctrls); 60 list_add(&ctrl->list, &mgr->amp_ctrls);
58 mutex_unlock(&mgr->amp_ctrls_lock); 61 mutex_unlock(&mgr->amp_ctrls_lock);
59 62
60 kref_init(&ctrl->kref);
61
62 BT_DBG("mgr %p ctrl %p", mgr, ctrl); 63 BT_DBG("mgr %p ctrl %p", mgr, ctrl);
63 64
64 return ctrl; 65 return ctrl;