diff options
author | Rémi Denis-Courmont <remi.denis-courmont@nokia.com> | 2011-03-08 23:44:10 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-09 20:59:32 +0100 |
commit | f7ae8d59f66154df0424fd94035c89981fed3379 (patch) | |
tree | 829e2a3e2188a30b48afbd200675bf8d0a21cb0d /net/phonet/socket.c | |
parent | Phonet: factor common code to send control messages (diff) | |
download | linux-f7ae8d59f66154df0424fd94035c89981fed3379.tar.xz linux-f7ae8d59f66154df0424fd94035c89981fed3379.zip |
Phonet: allocate sock from accept syscall rather than soft IRQ
This moves most of the accept logic to process context like other
socket stacks do. Then we can use a few more common socket helpers
and simplify a bit.
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r-- | net/phonet/socket.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/net/phonet/socket.c b/net/phonet/socket.c index 65a03338769e..1eccfc35bcc0 100644 --- a/net/phonet/socket.c +++ b/net/phonet/socket.c @@ -327,6 +327,9 @@ static int pn_socket_accept(struct socket *sock, struct socket *newsock, struct sock *newsk; int err; + if (unlikely(sk->sk_state != TCP_LISTEN)) + return -EINVAL; + newsk = sk->sk_prot->accept(sk, flags, &err); if (!newsk) return err; @@ -363,13 +366,8 @@ static unsigned int pn_socket_poll(struct file *file, struct socket *sock, poll_wait(file, sk_sleep(sk), wait); - switch (sk->sk_state) { - case TCP_LISTEN: - return hlist_empty(&pn->ackq) ? 0 : POLLIN; - case TCP_CLOSE: + if (sk->sk_state == TCP_CLOSE) return POLLERR; - } - if (!skb_queue_empty(&sk->sk_receive_queue)) mask |= POLLIN | POLLRDNORM; if (!skb_queue_empty(&pn->ctrlreq_queue)) |