Skip to content

Commit

Permalink
NFC: Update the LLCP poll mask
Browse files Browse the repository at this point in the history
Fix the poll mask depending on the socket state. POLLOUT was missing
for example.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Samuel Ortiz authored and John W. Linville committed May 15, 2012
1 parent ff353d8 commit 4260c13
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion net/nfc/llcp/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,24 @@ static unsigned int llcp_sock_poll(struct file *file, struct socket *sock,
mask |= POLLERR;

if (!skb_queue_empty(&sk->sk_receive_queue))
mask |= POLLIN;
mask |= POLLIN | POLLRDNORM;

if (sk->sk_state == LLCP_CLOSED)
mask |= POLLHUP;

if (sk->sk_shutdown & RCV_SHUTDOWN)
mask |= POLLRDHUP | POLLIN | POLLRDNORM;

if (sk->sk_shutdown == SHUTDOWN_MASK)
mask |= POLLHUP;

if (sock_writeable(sk))
mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
else
set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);

pr_debug("mask 0x%x\n", mask);

return mask;
}

Expand Down

0 comments on commit 4260c13

Please sign in to comment.