Return-Path: From: Gustavo Padovan To: linux-bluetooth@vger.kernel.org Cc: Gustavo Padovan Subject: [RFC 2/2] Bluetooth: Remove last usage of sk->sk_state_change() Date: Thu, 24 May 2012 04:00:17 -0300 Message-Id: <1337842817-27865-2-git-send-email-gustavo@padovan.org> In-Reply-To: <1337842817-27865-1-git-send-email-gustavo@padovan.org> References: <1337839374-20443-3-git-send-email-gustavo@padovan.org> <1337842817-27865-1-git-send-email-gustavo@padovan.org> Sender: linux-bluetooth-owner@vger.kernel.org List-ID: From: Gustavo Padovan If the is not oriented we should call sk_state_change() just after set the channel state to BT_CONNECTED. Signed-off-by: Gustavo Padovan --- net/bluetooth/l2cap_core.c | 6 +----- net/bluetooth/l2cap_sock.c | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 0d22695..6137b48 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -1176,12 +1176,8 @@ static void l2cap_conn_ready(struct l2cap_conn *conn) l2cap_chan_ready(chan); } else if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED) { - struct sock *sk = chan->sk; __clear_chan_timer(chan); - lock_sock(sk); - __l2cap_state_change(chan, BT_CONNECTED); - sk->sk_state_change(sk); - release_sock(sk); + l2cap_state_change(chan, BT_CONNECTED); } else if (chan->state == BT_CONNECT) l2cap_do_start(chan); diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index 0a1a827..9fd9412 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c @@ -1018,6 +1018,10 @@ static void l2cap_sock_state_change_cb(void *data, int state) struct sock *sk = data; sk->sk_state = state; + + if (state == BT_CONNECTED && + l2cap_pi(sk)->chan->chan_type != L2CAP_CHAN_CONN_ORIENTED) + sk->sk_state_change(sk); } static struct sk_buff *l2cap_sock_alloc_skb_cb(struct l2cap_chan *chan, -- 1.7.10.1