Skip to content

Commit

Permalink
xsk: Fix xsk_poll()'s return type
Browse files Browse the repository at this point in the history
xsk_poll() is defined as returning 'unsigned int' but the
.poll method is declared as returning '__poll_t', a bitwise type.

Fix this by using the proper return type and using the EPOLL
constants instead of the POLL ones, as required for __poll_t.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Link: https://lore.kernel.org/bpf/20191120001042.30830-1-luc.vanoostenryck@gmail.com
  • Loading branch information
lucvoo authored and Alexei Starovoitov committed Nov 25, 2019
1 parent c392bcc commit 5d946c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/xdp/xsk.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,10 @@ static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len)
return __xsk_sendmsg(sk);
}

static unsigned int xsk_poll(struct file *file, struct socket *sock,
static __poll_t xsk_poll(struct file *file, struct socket *sock,
struct poll_table_struct *wait)
{
unsigned int mask = datagram_poll(file, sock, wait);
__poll_t mask = datagram_poll(file, sock, wait);
struct sock *sk = sock->sk;
struct xdp_sock *xs = xdp_sk(sk);
struct net_device *dev;
Expand All @@ -472,9 +472,9 @@ static unsigned int xsk_poll(struct file *file, struct socket *sock,
}

if (xs->rx && !xskq_empty_desc(xs->rx))
mask |= POLLIN | POLLRDNORM;
mask |= EPOLLIN | EPOLLRDNORM;
if (xs->tx && !xskq_full_desc(xs->tx))
mask |= POLLOUT | POLLWRNORM;
mask |= EPOLLOUT | EPOLLWRNORM;

return mask;
}
Expand Down

0 comments on commit 5d946c5

Please sign in to comment.