From fa4ebc66c432d0e0ec947cb754d4144c4a681f28 Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Fri, 5 Oct 2012 16:56:55 +0300 Subject: 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 Signed-off-by: Gustavo Padovan --- net/bluetooth/amp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'net/bluetooth/amp.c') 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) return kref_put(&ctrl->kref, &_ctrl_destroy); } -struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr) +struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr, u8 id) { struct amp_ctrl *ctrl; @@ -53,12 +53,13 @@ struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr) if (!ctrl) return NULL; + kref_init(&ctrl->kref); + ctrl->id = id; + mutex_lock(&mgr->amp_ctrls_lock); list_add(&ctrl->list, &mgr->amp_ctrls); mutex_unlock(&mgr->amp_ctrls_lock); - kref_init(&ctrl->kref); - BT_DBG("mgr %p ctrl %p", mgr, ctrl); return ctrl; -- cgit