diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-04-13 18:50:45 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-04-28 00:09:59 -0400 |
commit | fe4128e0aabc3c748786c00da21e6eff9d3aeddb (patch) | |
tree | 6b62853c721023e6a05fdbbc0c806414632ef984 /net/bluetooth/l2cap_sock.c | |
parent | 0c1bc5c626e9783034264ccca4b262b3acc628f1 (diff) |
Bluetooth: Move more vars to struct l2cap_chan
In this commit, psm, scid and dcid.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/l2cap_sock.c')
-rw-r--r-- | net/bluetooth/l2cap_sock.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index eef33b179f02..f5a27737c151 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
@@ -141,7 +141,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) | |||
141 | } else { | 141 | } else { |
142 | /* Save source address */ | 142 | /* Save source address */ |
143 | bacpy(&bt_sk(sk)->src, &la.l2_bdaddr); | 143 | bacpy(&bt_sk(sk)->src, &la.l2_bdaddr); |
144 | l2cap_pi(sk)->psm = la.l2_psm; | 144 | chan->psm = la.l2_psm; |
145 | chan->sport = la.l2_psm; | 145 | chan->sport = la.l2_psm; |
146 | sk->sk_state = BT_BOUND; | 146 | sk->sk_state = BT_BOUND; |
147 | 147 | ||
@@ -151,7 +151,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) | |||
151 | } | 151 | } |
152 | 152 | ||
153 | if (la.l2_cid) | 153 | if (la.l2_cid) |
154 | l2cap_pi(sk)->scid = la.l2_cid; | 154 | chan->scid = la.l2_cid; |
155 | 155 | ||
156 | write_unlock_bh(&l2cap_sk_list.lock); | 156 | write_unlock_bh(&l2cap_sk_list.lock); |
157 | 157 | ||
@@ -232,8 +232,8 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al | |||
232 | 232 | ||
233 | /* Set destination address and psm */ | 233 | /* Set destination address and psm */ |
234 | bacpy(&bt_sk(sk)->dst, &la.l2_bdaddr); | 234 | bacpy(&bt_sk(sk)->dst, &la.l2_bdaddr); |
235 | l2cap_pi(sk)->psm = la.l2_psm; | 235 | chan->psm = la.l2_psm; |
236 | l2cap_pi(sk)->dcid = la.l2_cid; | 236 | chan->dcid = la.l2_cid; |
237 | 237 | ||
238 | err = l2cap_chan_connect(l2cap_pi(sk)->chan); | 238 | err = l2cap_chan_connect(l2cap_pi(sk)->chan); |
239 | if (err) | 239 | if (err) |
@@ -276,7 +276,7 @@ static int l2cap_sock_listen(struct socket *sock, int backlog) | |||
276 | goto done; | 276 | goto done; |
277 | } | 277 | } |
278 | 278 | ||
279 | if (!l2cap_pi(sk)->psm && !l2cap_pi(sk)->scid) { | 279 | if (!chan->psm && !chan->scid) { |
280 | bdaddr_t *src = &bt_sk(sk)->src; | 280 | bdaddr_t *src = &bt_sk(sk)->src; |
281 | u16 psm; | 281 | u16 psm; |
282 | 282 | ||
@@ -286,7 +286,7 @@ static int l2cap_sock_listen(struct socket *sock, int backlog) | |||
286 | 286 | ||
287 | for (psm = 0x1001; psm < 0x1100; psm += 2) | 287 | for (psm = 0x1001; psm < 0x1100; psm += 2) |
288 | if (!__l2cap_get_sock_by_addr(cpu_to_le16(psm), src)) { | 288 | if (!__l2cap_get_sock_by_addr(cpu_to_le16(psm), src)) { |
289 | l2cap_pi(sk)->psm = cpu_to_le16(psm); | 289 | chan->psm = cpu_to_le16(psm); |
290 | chan->sport = cpu_to_le16(psm); | 290 | chan->sport = cpu_to_le16(psm); |
291 | err = 0; | 291 | err = 0; |
292 | break; | 292 | break; |
@@ -375,13 +375,13 @@ static int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr, int *l | |||
375 | *len = sizeof(struct sockaddr_l2); | 375 | *len = sizeof(struct sockaddr_l2); |
376 | 376 | ||
377 | if (peer) { | 377 | if (peer) { |
378 | la->l2_psm = l2cap_pi(sk)->psm; | 378 | la->l2_psm = chan->psm; |
379 | bacpy(&la->l2_bdaddr, &bt_sk(sk)->dst); | 379 | bacpy(&la->l2_bdaddr, &bt_sk(sk)->dst); |
380 | la->l2_cid = cpu_to_le16(l2cap_pi(sk)->dcid); | 380 | la->l2_cid = cpu_to_le16(chan->dcid); |
381 | } else { | 381 | } else { |
382 | la->l2_psm = chan->sport; | 382 | la->l2_psm = chan->sport; |
383 | bacpy(&la->l2_bdaddr, &bt_sk(sk)->src); | 383 | bacpy(&la->l2_bdaddr, &bt_sk(sk)->src); |
384 | la->l2_cid = cpu_to_le16(l2cap_pi(sk)->scid); | 384 | la->l2_cid = cpu_to_le16(chan->scid); |
385 | } | 385 | } |
386 | 386 | ||
387 | return 0; | 387 | return 0; |
@@ -737,7 +737,7 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms | |||
737 | 737 | ||
738 | /* Connectionless channel */ | 738 | /* Connectionless channel */ |
739 | if (sk->sk_type == SOCK_DGRAM) { | 739 | if (sk->sk_type == SOCK_DGRAM) { |
740 | skb = l2cap_create_connless_pdu(sk, msg, len); | 740 | skb = l2cap_create_connless_pdu(chan, msg, len); |
741 | if (IS_ERR(skb)) { | 741 | if (IS_ERR(skb)) { |
742 | err = PTR_ERR(skb); | 742 | err = PTR_ERR(skb); |
743 | } else { | 743 | } else { |
@@ -756,7 +756,7 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms | |||
756 | } | 756 | } |
757 | 757 | ||
758 | /* Create a basic PDU */ | 758 | /* Create a basic PDU */ |
759 | skb = l2cap_create_basic_pdu(sk, msg, len); | 759 | skb = l2cap_create_basic_pdu(chan, msg, len); |
760 | if (IS_ERR(skb)) { | 760 | if (IS_ERR(skb)) { |
761 | err = PTR_ERR(skb); | 761 | err = PTR_ERR(skb); |
762 | goto done; | 762 | goto done; |
@@ -911,8 +911,8 @@ void __l2cap_sock_close(struct sock *sk, int reason) | |||
911 | else | 911 | else |
912 | result = L2CAP_CR_BAD_PSM; | 912 | result = L2CAP_CR_BAD_PSM; |
913 | 913 | ||
914 | rsp.scid = cpu_to_le16(l2cap_pi(sk)->dcid); | 914 | rsp.scid = cpu_to_le16(chan->dcid); |
915 | rsp.dcid = cpu_to_le16(l2cap_pi(sk)->scid); | 915 | rsp.dcid = cpu_to_le16(chan->scid); |
916 | rsp.result = cpu_to_le16(result); | 916 | rsp.result = cpu_to_le16(result); |
917 | rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO); | 917 | rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO); |
918 | l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_RSP, | 918 | l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_RSP, |