diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-05-16 17:24:37 -0300 |
---|---|---|
committer | Jaikumar Ganesh <jaikumar@google.com> | 2011-07-11 11:59:19 -0700 |
commit | b090c4b586097e4bfdb2dcd7b203db960e783a95 (patch) | |
tree | 5bf7f328546e4aa1b42e47659eea7cb79ab2fe72 /net/bluetooth/l2cap_core.c | |
parent | b87bf5b81d38fb89758fc52d80ebb987745af2cb (diff) | |
download | kernel_samsung_tuna-b090c4b586097e4bfdb2dcd7b203db960e783a95.zip kernel_samsung_tuna-b090c4b586097e4bfdb2dcd7b203db960e783a95.tar.gz kernel_samsung_tuna-b090c4b586097e4bfdb2dcd7b203db960e783a95.tar.bz2 |
Bluetooth: Add l2cap_chan_ops abstraction
Add an abstraction layer between L2CAP core and its users (only
l2cap_sock.c now). The first function implemented is new_connection() that
replaces calls to l2cap_sock_alloc() in l2cap_core.c
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/l2cap_core.c')
-rw-r--r-- | net/bluetooth/l2cap_core.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index fd4822a..23b2478 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -843,18 +843,16 @@ static void l2cap_le_conn_ready(struct l2cap_conn *conn) goto clean; } - sk = l2cap_sock_alloc(sock_net(parent), NULL, BTPROTO_L2CAP, GFP_ATOMIC); - if (!sk) + chan = pchan->ops->new_connection(pchan->data); + if (!chan) goto clean; - chan = l2cap_pi(sk)->chan; + sk = chan->sk; write_lock_bh(&conn->chan_lock); hci_conn_hold(conn->hcon); - l2cap_sock_init(sk, parent); - bacpy(&bt_sk(sk)->src, conn->src); bacpy(&bt_sk(sk)->dst, conn->dst); @@ -2330,10 +2328,12 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd goto response; } - sk = l2cap_sock_alloc(sock_net(parent), NULL, BTPROTO_L2CAP, GFP_ATOMIC); - if (!sk) + chan = pchan->ops->new_connection(pchan->data); + if (!chan) goto response; + sk = chan->sk; + write_lock_bh(&conn->chan_lock); /* Check if we already have channel with that dcid */ @@ -2346,9 +2346,6 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd hci_conn_hold(conn->hcon); - chan = l2cap_pi(sk)->chan; - - l2cap_sock_init(sk, parent); bacpy(&bt_sk(sk)->src, conn->src); bacpy(&bt_sk(sk)->dst, conn->dst); chan->psm = psm; |