diff options
author | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2013-10-15 18:24:49 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2013-10-15 19:42:44 -0400 |
commit | dc25306b033cc27ca2a45b4bb307a437092408d1 (patch) | |
tree | bf5794e0605990efeb48b5241f3dee81ab713c07 /net/bluetooth/l2cap_sock.c | |
parent | 5ec1bbe549d939ff1ef88e2cc22b2c3b95d76401 (diff) |
Bluetooth: Move l2cap_wait_ack() to l2cap_sock.c
The wait_ack code has a heavy dependency on the socket data structures
and, as of now, it won't be worthless change it to use non-socket
structures as the only user of such feature is a socket.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/l2cap_sock.c')
-rw-r--r-- | net/bluetooth/l2cap_sock.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index 301f25b9b521..68f486a586ff 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
@@ -879,6 +879,38 @@ static void l2cap_sock_kill(struct sock *sk) | |||
879 | sock_put(sk); | 879 | sock_put(sk); |
880 | } | 880 | } |
881 | 881 | ||
882 | static int __l2cap_wait_ack(struct sock *sk) | ||
883 | { | ||
884 | struct l2cap_chan *chan = l2cap_pi(sk)->chan; | ||
885 | DECLARE_WAITQUEUE(wait, current); | ||
886 | int err = 0; | ||
887 | int timeo = HZ/5; | ||
888 | |||
889 | add_wait_queue(sk_sleep(sk), &wait); | ||
890 | set_current_state(TASK_INTERRUPTIBLE); | ||
891 | while (chan->unacked_frames > 0 && chan->conn) { | ||
892 | if (!timeo) | ||
893 | timeo = HZ/5; | ||
894 | |||
895 | if (signal_pending(current)) { | ||
896 | err = sock_intr_errno(timeo); | ||
897 | break; | ||
898 | } | ||
899 | |||
900 | release_sock(sk); | ||
901 | timeo = schedule_timeout(timeo); | ||
902 | lock_sock(sk); | ||
903 | set_current_state(TASK_INTERRUPTIBLE); | ||
904 | |||
905 | err = sock_error(sk); | ||
906 | if (err) | ||
907 | break; | ||
908 | } | ||
909 | set_current_state(TASK_RUNNING); | ||
910 | remove_wait_queue(sk_sleep(sk), &wait); | ||
911 | return err; | ||
912 | } | ||
913 | |||
882 | static int l2cap_sock_shutdown(struct socket *sock, int how) | 914 | static int l2cap_sock_shutdown(struct socket *sock, int how) |
883 | { | 915 | { |
884 | struct sock *sk = sock->sk; | 916 | struct sock *sk = sock->sk; |