aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/sco.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2013-10-13 13:34:01 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2013-10-13 14:11:20 -0400
commiteea963641bf548bda164b92aa20ccda56c5cf349 (patch)
treeddfd4a7dde5160a7407c53082d637c49cfd47633 /net/bluetooth/sco.c
parent041987cff6fb7d2e7acd5897390ad0eef575ed39 (diff)
Bluetooth: Store SCO address information in its own socket structure
The address information of SCO sockets should be stored in its own socket structure. Trying to generalize them is not helpful since different transports have different address types. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/sco.c')
-rw-r--r--net/bluetooth/sco.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 2cc8f425613a..a92aebac56ca 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -158,9 +158,9 @@ static int sco_connect(struct sock *sk)
158 struct hci_dev *hdev; 158 struct hci_dev *hdev;
159 int err, type; 159 int err, type;
160 160
161 BT_DBG("%pMR -> %pMR", &bt_sk(sk)->src, &bt_sk(sk)->dst); 161 BT_DBG("%pMR -> %pMR", &sco_pi(sk)->src, &sco_pi(sk)->dst);
162 162
163 hdev = hci_get_route(&bt_sk(sk)->dst, &bt_sk(sk)->src); 163 hdev = hci_get_route(&sco_pi(sk)->dst, &sco_pi(sk)->src);
164 if (!hdev) 164 if (!hdev)
165 return -EHOSTUNREACH; 165 return -EHOSTUNREACH;
166 166
@@ -177,7 +177,7 @@ static int sco_connect(struct sock *sk)
177 goto done; 177 goto done;
178 } 178 }
179 179
180 hcon = hci_connect_sco(hdev, type, &bt_sk(sk)->dst, 180 hcon = hci_connect_sco(hdev, type, &sco_pi(sk)->dst,
181 sco_pi(sk)->setting); 181 sco_pi(sk)->setting);
182 if (IS_ERR(hcon)) { 182 if (IS_ERR(hcon)) {
183 err = PTR_ERR(hcon); 183 err = PTR_ERR(hcon);
@@ -192,7 +192,7 @@ static int sco_connect(struct sock *sk)
192 } 192 }
193 193
194 /* Update source addr of the socket */ 194 /* Update source addr of the socket */
195 bacpy(&bt_sk(sk)->src, &hcon->src); 195 bacpy(&sco_pi(sk)->src, &hcon->src);
196 196
197 err = sco_chan_add(conn, sk, NULL); 197 err = sco_chan_add(conn, sk, NULL);
198 if (err) 198 if (err)
@@ -266,7 +266,7 @@ static struct sock *__sco_get_sock_listen_by_addr(bdaddr_t *ba)
266 if (sk->sk_state != BT_LISTEN) 266 if (sk->sk_state != BT_LISTEN)
267 continue; 267 continue;
268 268
269 if (!bacmp(&bt_sk(sk)->src, ba)) 269 if (!bacmp(&sco_pi(sk)->src, ba))
270 return sk; 270 return sk;
271 } 271 }
272 272
@@ -287,11 +287,11 @@ static struct sock *sco_get_sock_listen(bdaddr_t *src)
287 continue; 287 continue;
288 288
289 /* Exact match. */ 289 /* Exact match. */
290 if (!bacmp(&bt_sk(sk)->src, src)) 290 if (!bacmp(&sco_pi(sk)->src, src))
291 break; 291 break;
292 292
293 /* Closest match */ 293 /* Closest match */
294 if (!bacmp(&bt_sk(sk)->src, BDADDR_ANY)) 294 if (!bacmp(&sco_pi(sk)->src, BDADDR_ANY))
295 sk1 = sk; 295 sk1 = sk;
296 } 296 }
297 297
@@ -471,7 +471,7 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
471 goto done; 471 goto done;
472 } 472 }
473 473
474 bacpy(&bt_sk(sk)->src, &sa->sco_bdaddr); 474 bacpy(&sco_pi(sk)->src, &sa->sco_bdaddr);
475 475
476 sk->sk_state = BT_BOUND; 476 sk->sk_state = BT_BOUND;
477 477
@@ -501,7 +501,7 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen
501 lock_sock(sk); 501 lock_sock(sk);
502 502
503 /* Set destination address and psm */ 503 /* Set destination address and psm */
504 bacpy(&bt_sk(sk)->dst, &sa->sco_bdaddr); 504 bacpy(&sco_pi(sk)->dst, &sa->sco_bdaddr);
505 505
506 err = sco_connect(sk); 506 err = sco_connect(sk);
507 if (err) 507 if (err)
@@ -518,7 +518,7 @@ done:
518static int sco_sock_listen(struct socket *sock, int backlog) 518static int sco_sock_listen(struct socket *sock, int backlog)
519{ 519{
520 struct sock *sk = sock->sk; 520 struct sock *sk = sock->sk;
521 bdaddr_t *src = &bt_sk(sk)->src; 521 bdaddr_t *src = &sco_pi(sk)->src;
522 int err = 0; 522 int err = 0;
523 523
524 BT_DBG("sk %p backlog %d", sk, backlog); 524 BT_DBG("sk %p backlog %d", sk, backlog);
@@ -622,9 +622,9 @@ static int sco_sock_getname(struct socket *sock, struct sockaddr *addr, int *len
622 *len = sizeof(struct sockaddr_sco); 622 *len = sizeof(struct sockaddr_sco);
623 623
624 if (peer) 624 if (peer)
625 bacpy(&sa->sco_bdaddr, &bt_sk(sk)->dst); 625 bacpy(&sa->sco_bdaddr, &sco_pi(sk)->dst);
626 else 626 else
627 bacpy(&sa->sco_bdaddr, &bt_sk(sk)->src); 627 bacpy(&sa->sco_bdaddr, &sco_pi(sk)->src);
628 628
629 return 0; 629 return 0;
630} 630}
@@ -1013,8 +1013,8 @@ static void sco_conn_ready(struct sco_conn *conn)
1013 1013
1014 sco_sock_init(sk, parent); 1014 sco_sock_init(sk, parent);
1015 1015
1016 bacpy(&bt_sk(sk)->src, &conn->hcon->src); 1016 bacpy(&sco_pi(sk)->src, &conn->hcon->src);
1017 bacpy(&bt_sk(sk)->dst, &conn->hcon->dst); 1017 bacpy(&sco_pi(sk)->dst, &conn->hcon->dst);
1018 1018
1019 hci_conn_hold(conn->hcon); 1019 hci_conn_hold(conn->hcon);
1020 __sco_chan_add(conn, sk, parent); 1020 __sco_chan_add(conn, sk, parent);
@@ -1047,8 +1047,8 @@ int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags)
1047 if (sk->sk_state != BT_LISTEN) 1047 if (sk->sk_state != BT_LISTEN)
1048 continue; 1048 continue;
1049 1049
1050 if (!bacmp(&bt_sk(sk)->src, &hdev->bdaddr) || 1050 if (!bacmp(&sco_pi(sk)->src, &hdev->bdaddr) ||
1051 !bacmp(&bt_sk(sk)->src, BDADDR_ANY)) { 1051 !bacmp(&sco_pi(sk)->src, BDADDR_ANY)) {
1052 lm |= HCI_LM_ACCEPT; 1052 lm |= HCI_LM_ACCEPT;
1053 1053
1054 if (test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) 1054 if (test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags))
@@ -1107,8 +1107,8 @@ static int sco_debugfs_show(struct seq_file *f, void *p)
1107 read_lock(&sco_sk_list.lock); 1107 read_lock(&sco_sk_list.lock);
1108 1108
1109 sk_for_each(sk, &sco_sk_list.head) { 1109 sk_for_each(sk, &sco_sk_list.head) {
1110 seq_printf(f, "%pMR %pMR %d\n", &bt_sk(sk)->src, 1110 seq_printf(f, "%pMR %pMR %d\n", &sco_pi(sk)->src,
1111 &bt_sk(sk)->dst, sk->sk_state); 1111 &sco_pi(sk)->dst, sk->sk_state);
1112 } 1112 }
1113 1113
1114 read_unlock(&sco_sk_list.lock); 1114 read_unlock(&sco_sk_list.lock);