diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2013-10-13 13:15:22 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-10-13 14:11:18 -0400 |
commit | 041987cff6fb7d2e7acd5897390ad0eef575ed39 (patch) | |
tree | f058224f8794c06532d123c3163945617bcf24cc | |
parent | 65f53e9802dbfae0e5758a91793c3f5f8bece49b (diff) |
Bluetooth: Use SCO addresses from HCI connection directly
Instead of storing a pointer to the addresses for the HCI device
and HCI connection, use them directly. With the recent changes
to address tracking of HCI connections, this becomes simple.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r-- | include/net/bluetooth/sco.h | 3 | ||||
-rw-r--r-- | net/bluetooth/sco.c | 20 |
2 files changed, 8 insertions, 15 deletions
diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h index e252a31ee6b6..94703a25d1c2 100644 --- a/include/net/bluetooth/sco.h +++ b/include/net/bluetooth/sco.h | |||
@@ -55,9 +55,6 @@ struct sco_conninfo { | |||
55 | struct sco_conn { | 55 | struct sco_conn { |
56 | struct hci_conn *hcon; | 56 | struct hci_conn *hcon; |
57 | 57 | ||
58 | bdaddr_t *dst; | ||
59 | bdaddr_t *src; | ||
60 | |||
61 | spinlock_t lock; | 58 | spinlock_t lock; |
62 | struct sock *sk; | 59 | struct sock *sk; |
63 | 60 | ||
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 96bd388d93a4..2cc8f425613a 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -92,9 +92,6 @@ static struct sco_conn *sco_conn_add(struct hci_conn *hcon) | |||
92 | hcon->sco_data = conn; | 92 | hcon->sco_data = conn; |
93 | conn->hcon = hcon; | 93 | conn->hcon = hcon; |
94 | 94 | ||
95 | conn->src = &hdev->bdaddr; | ||
96 | conn->dst = &hcon->dst; | ||
97 | |||
98 | if (hdev->sco_mtu > 0) | 95 | if (hdev->sco_mtu > 0) |
99 | conn->mtu = hdev->sco_mtu; | 96 | conn->mtu = hdev->sco_mtu; |
100 | else | 97 | else |
@@ -156,16 +153,14 @@ static int sco_chan_add(struct sco_conn *conn, struct sock *sk, | |||
156 | 153 | ||
157 | static int sco_connect(struct sock *sk) | 154 | static int sco_connect(struct sock *sk) |
158 | { | 155 | { |
159 | bdaddr_t *src = &bt_sk(sk)->src; | ||
160 | bdaddr_t *dst = &bt_sk(sk)->dst; | ||
161 | struct sco_conn *conn; | 156 | struct sco_conn *conn; |
162 | struct hci_conn *hcon; | 157 | struct hci_conn *hcon; |
163 | struct hci_dev *hdev; | 158 | struct hci_dev *hdev; |
164 | int err, type; | 159 | int err, type; |
165 | 160 | ||
166 | BT_DBG("%pMR -> %pMR", src, dst); | 161 | BT_DBG("%pMR -> %pMR", &bt_sk(sk)->src, &bt_sk(sk)->dst); |
167 | 162 | ||
168 | hdev = hci_get_route(dst, src); | 163 | hdev = hci_get_route(&bt_sk(sk)->dst, &bt_sk(sk)->src); |
169 | if (!hdev) | 164 | if (!hdev) |
170 | return -EHOSTUNREACH; | 165 | return -EHOSTUNREACH; |
171 | 166 | ||
@@ -182,7 +177,8 @@ static int sco_connect(struct sock *sk) | |||
182 | goto done; | 177 | goto done; |
183 | } | 178 | } |
184 | 179 | ||
185 | hcon = hci_connect_sco(hdev, type, dst, sco_pi(sk)->setting); | 180 | hcon = hci_connect_sco(hdev, type, &bt_sk(sk)->dst, |
181 | sco_pi(sk)->setting); | ||
186 | if (IS_ERR(hcon)) { | 182 | if (IS_ERR(hcon)) { |
187 | err = PTR_ERR(hcon); | 183 | err = PTR_ERR(hcon); |
188 | goto done; | 184 | goto done; |
@@ -196,7 +192,7 @@ static int sco_connect(struct sock *sk) | |||
196 | } | 192 | } |
197 | 193 | ||
198 | /* Update source addr of the socket */ | 194 | /* Update source addr of the socket */ |
199 | bacpy(src, conn->src); | 195 | bacpy(&bt_sk(sk)->src, &hcon->src); |
200 | 196 | ||
201 | err = sco_chan_add(conn, sk, NULL); | 197 | err = sco_chan_add(conn, sk, NULL); |
202 | if (err) | 198 | if (err) |
@@ -999,7 +995,7 @@ static void sco_conn_ready(struct sco_conn *conn) | |||
999 | } else { | 995 | } else { |
1000 | sco_conn_lock(conn); | 996 | sco_conn_lock(conn); |
1001 | 997 | ||
1002 | parent = sco_get_sock_listen(conn->src); | 998 | parent = sco_get_sock_listen(&conn->hcon->src); |
1003 | if (!parent) { | 999 | if (!parent) { |
1004 | sco_conn_unlock(conn); | 1000 | sco_conn_unlock(conn); |
1005 | return; | 1001 | return; |
@@ -1017,8 +1013,8 @@ static void sco_conn_ready(struct sco_conn *conn) | |||
1017 | 1013 | ||
1018 | sco_sock_init(sk, parent); | 1014 | sco_sock_init(sk, parent); |
1019 | 1015 | ||
1020 | bacpy(&bt_sk(sk)->src, conn->src); | 1016 | bacpy(&bt_sk(sk)->src, &conn->hcon->src); |
1021 | bacpy(&bt_sk(sk)->dst, conn->dst); | 1017 | bacpy(&bt_sk(sk)->dst, &conn->hcon->dst); |
1022 | 1018 | ||
1023 | hci_conn_hold(conn->hcon); | 1019 | hci_conn_hold(conn->hcon); |
1024 | __sco_chan_add(conn, sk, parent); | 1020 | __sco_chan_add(conn, sk, parent); |