aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2012-10-05 09:56:56 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-10-07 18:21:51 -0400
commita0c234fe8972aa6a5afe2db6c27a3f5d5fbd88e7 (patch)
treea47cdeec7101d6b06537174b3d41358a572ebd1f
parentfa4ebc66c432d0e0ec947cb754d4144c4a681f28 (diff)
Bluetooth: AMP: Factor out phylink_add
Add direction parameter to phylink_add since it is anyway set later. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
-rw-r--r--include/net/bluetooth/amp.h2
-rw-r--r--net/bluetooth/a2mp.c4
-rw-r--r--net/bluetooth/amp.c6
3 files changed, 7 insertions, 5 deletions
diff --git a/include/net/bluetooth/amp.h b/include/net/bluetooth/amp.h
index ae2c3e53647..2e7c79ea046 100644
--- a/include/net/bluetooth/amp.h
+++ b/include/net/bluetooth/amp.h
@@ -31,7 +31,7 @@ struct amp_ctrl *amp_ctrl_lookup(struct amp_mgr *mgr, u8 id);
31void amp_ctrl_list_flush(struct amp_mgr *mgr); 31void amp_ctrl_list_flush(struct amp_mgr *mgr);
32 32
33struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr, 33struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
34 u8 remote_id); 34 u8 remote_id, bool out);
35 35
36int phylink_gen_key(struct hci_conn *hcon, u8 *data, u8 *len, u8 *type); 36int phylink_gen_key(struct hci_conn *hcon, u8 *data, u8 *len, u8 *type);
37 37
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index 88a4b583d21..3ff4dc928bf 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -417,7 +417,7 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb,
417 if (!hdev) 417 if (!hdev)
418 return -EINVAL; 418 return -EINVAL;
419 419
420 hcon = phylink_add(hdev, mgr, rsp->id); 420 hcon = phylink_add(hdev, mgr, rsp->id, true);
421 if (!hcon) 421 if (!hcon)
422 goto done; 422 goto done;
423 423
@@ -487,7 +487,7 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
487 amp_ctrl_put(ctrl); 487 amp_ctrl_put(ctrl);
488 } 488 }
489 489
490 hcon = phylink_add(hdev, mgr, req->local_id); 490 hcon = phylink_add(hdev, mgr, req->local_id, false);
491 if (hcon) { 491 if (hcon) {
492 amp_accept_phylink(hdev, mgr, hcon); 492 amp_accept_phylink(hdev, mgr, hcon);
493 rsp.status = A2MP_STATUS_SUCCESS; 493 rsp.status = A2MP_STATUS_SUCCESS;
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 2fc5562a84b..59da0f15818 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -108,7 +108,7 @@ static u8 __next_handle(struct amp_mgr *mgr)
108} 108}
109 109
110struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr, 110struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
111 u8 remote_id) 111 u8 remote_id, bool out)
112{ 112{
113 bdaddr_t *dst = mgr->l2cap_conn->dst; 113 bdaddr_t *dst = mgr->l2cap_conn->dst;
114 struct hci_conn *hcon; 114 struct hci_conn *hcon;
@@ -117,12 +117,14 @@ struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
117 if (!hcon) 117 if (!hcon)
118 return NULL; 118 return NULL;
119 119
120 BT_DBG("hcon %p dst %pMR", hcon, dst);
121
120 hcon->state = BT_CONNECT; 122 hcon->state = BT_CONNECT;
121 hcon->out = true;
122 hcon->attempt++; 123 hcon->attempt++;
123 hcon->handle = __next_handle(mgr); 124 hcon->handle = __next_handle(mgr);
124 hcon->remote_id = remote_id; 125 hcon->remote_id = remote_id;
125 hcon->amp_mgr = mgr; 126 hcon->amp_mgr = mgr;
127 hcon->out = out;
126 128
127 return hcon; 129 return hcon;
128} 130}