aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap_sock.c
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2011-04-12 17:15:09 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-04-27 17:51:34 -0400
commitb44500351845e4f6df0d752a8870da246be8216f (patch)
tree3f0faf668af01c72c408be1eea043c73bff2c0b9 /net/bluetooth/l2cap_sock.c
parent5d41ce1dd91bce01d50aff79786dc5d5eedcfab7 (diff)
Bluetooth: Move conf_state to struct l2cap_chan
First move of elements depending on user data. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/l2cap_sock.c')
-rw-r--r--net/bluetooth/l2cap_sock.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index e3724572c448..a29782a0083a 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -528,6 +528,7 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, ch
528static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __user *optval, unsigned int optlen) 528static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __user *optval, unsigned int optlen)
529{ 529{
530 struct sock *sk = sock->sk; 530 struct sock *sk = sock->sk;
531 struct l2cap_chan *chan = l2cap_pi(sk)->chan;
531 struct l2cap_options opts; 532 struct l2cap_options opts;
532 int len, err = 0; 533 int len, err = 0;
533 u32 opt; 534 u32 opt;
@@ -565,7 +566,7 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
565 l2cap_pi(sk)->mode = opts.mode; 566 l2cap_pi(sk)->mode = opts.mode;
566 switch (l2cap_pi(sk)->mode) { 567 switch (l2cap_pi(sk)->mode) {
567 case L2CAP_MODE_BASIC: 568 case L2CAP_MODE_BASIC:
568 l2cap_pi(sk)->conf_state &= ~L2CAP_CONF_STATE2_DEVICE; 569 chan->conf_state &= ~L2CAP_CONF_STATE2_DEVICE;
569 break; 570 break;
570 case L2CAP_MODE_ERTM: 571 case L2CAP_MODE_ERTM:
571 case L2CAP_MODE_STREAMING: 572 case L2CAP_MODE_STREAMING:
@@ -979,16 +980,19 @@ static void l2cap_sock_destruct(struct sock *sk)
979void l2cap_sock_init(struct sock *sk, struct sock *parent) 980void l2cap_sock_init(struct sock *sk, struct sock *parent)
980{ 981{
981 struct l2cap_pinfo *pi = l2cap_pi(sk); 982 struct l2cap_pinfo *pi = l2cap_pi(sk);
983 struct l2cap_chan *chan = pi->chan;
982 984
983 BT_DBG("sk %p", sk); 985 BT_DBG("sk %p", sk);
984 986
985 if (parent) { 987 if (parent) {
988 struct l2cap_chan *pchan = l2cap_pi(parent)->chan;
989
986 sk->sk_type = parent->sk_type; 990 sk->sk_type = parent->sk_type;
987 bt_sk(sk)->defer_setup = bt_sk(parent)->defer_setup; 991 bt_sk(sk)->defer_setup = bt_sk(parent)->defer_setup;
988 992
989 pi->imtu = l2cap_pi(parent)->imtu; 993 pi->imtu = l2cap_pi(parent)->imtu;
990 pi->omtu = l2cap_pi(parent)->omtu; 994 pi->omtu = l2cap_pi(parent)->omtu;
991 pi->conf_state = l2cap_pi(parent)->conf_state; 995 chan->conf_state = pchan->conf_state;
992 pi->mode = l2cap_pi(parent)->mode; 996 pi->mode = l2cap_pi(parent)->mode;
993 pi->fcs = l2cap_pi(parent)->fcs; 997 pi->fcs = l2cap_pi(parent)->fcs;
994 pi->max_tx = l2cap_pi(parent)->max_tx; 998 pi->max_tx = l2cap_pi(parent)->max_tx;
@@ -1002,7 +1006,7 @@ void l2cap_sock_init(struct sock *sk, struct sock *parent)
1002 pi->omtu = 0; 1006 pi->omtu = 0;
1003 if (!disable_ertm && sk->sk_type == SOCK_STREAM) { 1007 if (!disable_ertm && sk->sk_type == SOCK_STREAM) {
1004 pi->mode = L2CAP_MODE_ERTM; 1008 pi->mode = L2CAP_MODE_ERTM;
1005 pi->conf_state |= L2CAP_CONF_STATE2_DEVICE; 1009 chan->conf_state |= L2CAP_CONF_STATE2_DEVICE;
1006 } else { 1010 } else {
1007 pi->mode = L2CAP_MODE_BASIC; 1011 pi->mode = L2CAP_MODE_BASIC;
1008 } 1012 }