Commit a0c234fe authored by Andrei Emeltchenko's avatar Andrei Emeltchenko Committed by Gustavo Padovan

Bluetooth: AMP: Factor out phylink_add

Add direction parameter to phylink_add since it is anyway set later.
Signed-off-by: default avatarAndrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
parent fa4ebc66
...@@ -31,7 +31,7 @@ struct amp_ctrl *amp_ctrl_lookup(struct amp_mgr *mgr, u8 id); ...@@ -31,7 +31,7 @@ struct amp_ctrl *amp_ctrl_lookup(struct amp_mgr *mgr, u8 id);
void amp_ctrl_list_flush(struct amp_mgr *mgr); void amp_ctrl_list_flush(struct amp_mgr *mgr);
struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr, struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
u8 remote_id); u8 remote_id, bool out);
int phylink_gen_key(struct hci_conn *hcon, u8 *data, u8 *len, u8 *type); int phylink_gen_key(struct hci_conn *hcon, u8 *data, u8 *len, u8 *type);
......
...@@ -417,7 +417,7 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb, ...@@ -417,7 +417,7 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb,
if (!hdev) if (!hdev)
return -EINVAL; return -EINVAL;
hcon = phylink_add(hdev, mgr, rsp->id); hcon = phylink_add(hdev, mgr, rsp->id, true);
if (!hcon) if (!hcon)
goto done; goto done;
...@@ -487,7 +487,7 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb, ...@@ -487,7 +487,7 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
amp_ctrl_put(ctrl); amp_ctrl_put(ctrl);
} }
hcon = phylink_add(hdev, mgr, req->local_id); hcon = phylink_add(hdev, mgr, req->local_id, false);
if (hcon) { if (hcon) {
amp_accept_phylink(hdev, mgr, hcon); amp_accept_phylink(hdev, mgr, hcon);
rsp.status = A2MP_STATUS_SUCCESS; rsp.status = A2MP_STATUS_SUCCESS;
......
...@@ -108,7 +108,7 @@ static u8 __next_handle(struct amp_mgr *mgr) ...@@ -108,7 +108,7 @@ static u8 __next_handle(struct amp_mgr *mgr)
} }
struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr, struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
u8 remote_id) u8 remote_id, bool out)
{ {
bdaddr_t *dst = mgr->l2cap_conn->dst; bdaddr_t *dst = mgr->l2cap_conn->dst;
struct hci_conn *hcon; struct hci_conn *hcon;
...@@ -117,12 +117,14 @@ struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr, ...@@ -117,12 +117,14 @@ struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
if (!hcon) if (!hcon)
return NULL; return NULL;
BT_DBG("hcon %p dst %pMR", hcon, dst);
hcon->state = BT_CONNECT; hcon->state = BT_CONNECT;
hcon->out = true;
hcon->attempt++; hcon->attempt++;
hcon->handle = __next_handle(mgr); hcon->handle = __next_handle(mgr);
hcon->remote_id = remote_id; hcon->remote_id = remote_id;
hcon->amp_mgr = mgr; hcon->amp_mgr = mgr;
hcon->out = out;
return hcon; return hcon;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment