aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap_sock.c
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2011-04-13 19:23:55 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-04-28 00:10:00 -0400
commit8c1d787be4b62d2d1b6f04953eca4bcf7c839d44 (patch)
treee2a35c5cb81cc5109c13c2747b039fa05ea55a6e /net/bluetooth/l2cap_sock.c
parentfe4128e0aabc3c748786c00da21e6eff9d3aeddb (diff)
Bluetooth: Move conn to struct l2cap_chan
There is no need to the socket deal directly with the channel, most of the time it cares about the channel only. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/l2cap_sock.c')
-rw-r--r--net/bluetooth/l2cap_sock.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index f5a27737c151..61d93f6c36c8 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -455,8 +455,8 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us
455 break; 455 break;
456 } 456 }
457 457
458 cinfo.hci_handle = l2cap_pi(sk)->conn->hcon->handle; 458 cinfo.hci_handle = chan->conn->hcon->handle;
459 memcpy(cinfo.dev_class, l2cap_pi(sk)->conn->hcon->dev_class, 3); 459 memcpy(cinfo.dev_class, chan->conn->hcon->dev_class, 3);
460 460
461 len = min_t(unsigned int, len, sizeof(cinfo)); 461 len = min_t(unsigned int, len, sizeof(cinfo));
462 if (copy_to_user(optval, (char *) &cinfo, len)) 462 if (copy_to_user(optval, (char *) &cinfo, len))
@@ -690,7 +690,7 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
690 } 690 }
691 691
692 if (opt == BT_FLUSHABLE_OFF) { 692 if (opt == BT_FLUSHABLE_OFF) {
693 struct l2cap_conn *conn = l2cap_pi(sk)->conn; 693 struct l2cap_conn *conn = chan->conn;
694 /* proceed futher only when we have l2cap_conn and 694 /* proceed futher only when we have l2cap_conn and
695 No Flush support in the LM */ 695 No Flush support in the LM */
696 if (!conn || !lmp_no_flush_capable(conn->hcon->hdev)) { 696 if (!conn || !lmp_no_flush_capable(conn->hcon->hdev)) {
@@ -823,7 +823,9 @@ static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct ms
823 lock_sock(sk); 823 lock_sock(sk);
824 824
825 if (sk->sk_state == BT_CONNECT2 && bt_sk(sk)->defer_setup) { 825 if (sk->sk_state == BT_CONNECT2 && bt_sk(sk)->defer_setup) {
826 __l2cap_connect_rsp_defer(sk); 826 sk->sk_state = BT_CONFIG;
827
828 __l2cap_connect_rsp_defer(l2cap_pi(sk)->chan);
827 release_sock(sk); 829 release_sock(sk);
828 return 0; 830 return 0;
829 } 831 }
@@ -878,8 +880,8 @@ static void l2cap_sock_cleanup_listen(struct sock *parent)
878 880
879void __l2cap_sock_close(struct sock *sk, int reason) 881void __l2cap_sock_close(struct sock *sk, int reason)
880{ 882{
881 struct l2cap_conn *conn = l2cap_pi(sk)->conn;
882 struct l2cap_chan *chan = l2cap_pi(sk)->chan; 883 struct l2cap_chan *chan = l2cap_pi(sk)->chan;
884 struct l2cap_conn *conn = chan->conn;
883 885
884 BT_DBG("sk %p state %d socket %p", sk, sk->sk_state, sk->sk_socket); 886 BT_DBG("sk %p state %d socket %p", sk, sk->sk_state, sk->sk_socket);
885 887