aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2011-03-24 23:39:48 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-03-31 13:22:57 -0400
commitd1010240fa9aac93da56a683c1295e759ee69d10 (patch)
treeefa5ea02bb721a2388dc77a2bf8a9c8c6c641ae0 /net
parentf3dd4f0f586b3a70734820b68c69985363e2d798 (diff)
Bluetooth: Move bt_accept_enqueue() to outside __l2cap_chan_add
bt_accept_enqueue() is not really a channel action, so do it outside. This patch is part of a set of patches to create an struct l2cap_chan to have a clear separation between the struct sock and the L2CAP channel stuff. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/l2cap_core.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index b5a1ce06e1c0..bf09f6027bd2 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -169,7 +169,7 @@ static inline void l2cap_chan_unlink(struct l2cap_chan_list *l, struct sock *sk)
169 __sock_put(sk); 169 __sock_put(sk);
170} 170}
171 171
172static void __l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk, struct sock *parent) 172static void __l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk)
173{ 173{
174 struct l2cap_chan_list *l = &conn->chan_list; 174 struct l2cap_chan_list *l = &conn->chan_list;
175 175
@@ -204,9 +204,6 @@ static void __l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk, struct so
204 } 204 }
205 205
206 __l2cap_chan_link(l, sk); 206 __l2cap_chan_link(l, sk);
207
208 if (parent)
209 bt_accept_enqueue(parent, sk);
210} 207}
211 208
212/* Delete channel. 209/* Delete channel.
@@ -652,7 +649,9 @@ static void l2cap_le_conn_ready(struct l2cap_conn *conn)
652 bacpy(&bt_sk(sk)->src, conn->src); 649 bacpy(&bt_sk(sk)->src, conn->src);
653 bacpy(&bt_sk(sk)->dst, conn->dst); 650 bacpy(&bt_sk(sk)->dst, conn->dst);
654 651
655 __l2cap_chan_add(conn, sk, parent); 652 bt_accept_enqueue(parent, sk);
653
654 __l2cap_chan_add(conn, sk);
656 655
657 l2cap_sock_set_timer(sk, sk->sk_sndtimeo); 656 l2cap_sock_set_timer(sk, sk->sk_sndtimeo);
658 657
@@ -793,11 +792,11 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err)
793 kfree(conn); 792 kfree(conn);
794} 793}
795 794
796static inline void l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk, struct sock *parent) 795static inline void l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk)
797{ 796{
798 struct l2cap_chan_list *l = &conn->chan_list; 797 struct l2cap_chan_list *l = &conn->chan_list;
799 write_lock_bh(&l->lock); 798 write_lock_bh(&l->lock);
800 __l2cap_chan_add(conn, sk, parent); 799 __l2cap_chan_add(conn, sk);
801 write_unlock_bh(&l->lock); 800 write_unlock_bh(&l->lock);
802} 801}
803 802
@@ -876,7 +875,7 @@ int l2cap_do_connect(struct sock *sk)
876 /* Update source addr of the socket */ 875 /* Update source addr of the socket */
877 bacpy(src, conn->src); 876 bacpy(src, conn->src);
878 877
879 l2cap_chan_add(conn, sk, NULL); 878 l2cap_chan_add(conn, sk);
880 879
881 sk->sk_state = BT_CONNECT; 880 sk->sk_state = BT_CONNECT;
882 l2cap_sock_set_timer(sk, sk->sk_sndtimeo); 881 l2cap_sock_set_timer(sk, sk->sk_sndtimeo);
@@ -2030,7 +2029,9 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd
2030 l2cap_pi(sk)->psm = psm; 2029 l2cap_pi(sk)->psm = psm;
2031 l2cap_pi(sk)->dcid = scid; 2030 l2cap_pi(sk)->dcid = scid;
2032 2031
2033 __l2cap_chan_add(conn, sk, parent); 2032 bt_accept_enqueue(parent, sk);
2033
2034 __l2cap_chan_add(conn, sk);
2034 dcid = l2cap_pi(sk)->scid; 2035 dcid = l2cap_pi(sk)->scid;
2035 2036
2036 l2cap_sock_set_timer(sk, sk->sk_sndtimeo); 2037 l2cap_sock_set_timer(sk, sk->sk_sndtimeo);