diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-05-16 17:23:24 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-06-13 13:55:33 -0400 |
commit | ba3bd0ee3946d9300512e685e8d5573dfa10c060 (patch) | |
tree | 73bf8ee0b2c9aede60e3ccb52968cd253027d399 /net/bluetooth/l2cap_sock.c | |
parent | 230704942283cb3990584ddd6955ac8decfa6a2c (diff) |
Bluetooth: add close() callback to l2cap_chan_ops
close() calls l2cap_sock_kill() on l2cap_sock.c
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/l2cap_sock.c')
-rw-r--r-- | net/bluetooth/l2cap_sock.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index 28cdc7e6df54..9f15a164993a 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
@@ -713,7 +713,7 @@ static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct ms | |||
713 | /* Kill socket (only if zapped and orphan) | 713 | /* Kill socket (only if zapped and orphan) |
714 | * Must be called on unlocked socket. | 714 | * Must be called on unlocked socket. |
715 | */ | 715 | */ |
716 | void l2cap_sock_kill(struct sock *sk) | 716 | static void l2cap_sock_kill(struct sock *sk) |
717 | { | 717 | { |
718 | if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket) | 718 | if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket) |
719 | return; | 719 | return; |
@@ -796,10 +796,18 @@ static int l2cap_sock_recv_cb(void *data, struct sk_buff *skb) | |||
796 | return sock_queue_rcv_skb(sk, skb); | 796 | return sock_queue_rcv_skb(sk, skb); |
797 | } | 797 | } |
798 | 798 | ||
799 | static void l2cap_sock_close_cb(void *data) | ||
800 | { | ||
801 | struct sock *sk = data; | ||
802 | |||
803 | l2cap_sock_kill(sk); | ||
804 | } | ||
805 | |||
799 | static struct l2cap_ops l2cap_chan_ops = { | 806 | static struct l2cap_ops l2cap_chan_ops = { |
800 | .name = "L2CAP Socket Interface", | 807 | .name = "L2CAP Socket Interface", |
801 | .new_connection = l2cap_sock_new_connection_cb, | 808 | .new_connection = l2cap_sock_new_connection_cb, |
802 | .recv = l2cap_sock_recv_cb, | 809 | .recv = l2cap_sock_recv_cb, |
810 | .close = l2cap_sock_close_cb, | ||
803 | }; | 811 | }; |
804 | 812 | ||
805 | static void l2cap_sock_destruct(struct sock *sk) | 813 | static void l2cap_sock_destruct(struct sock *sk) |