diff options
author | Christoph Hellwig <hch@lst.de> | 2018-01-09 16:07:34 +0100 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-26 09:16:44 +0200 |
commit | 3cafb37633a1230011c5415e6f394b05260d21ad (patch) | |
tree | 4bb789ef23b3e6e8a9ed3295a1a1ddb674dd250d /net/socket.c | |
parent | 1962da0d2198a00a056a2915fbc6ec684c3bef0a (diff) |
net: refactor socket_poll
Factor out two busy poll related helpers for late reuse, and remove
a command that isn't very helpful, especially with the __poll_t
annotations in place.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/net/socket.c b/net/socket.c index f10f1d947c78..571ee4005192 100644 --- a/net/socket.c +++ b/net/socket.c @@ -1117,24 +1117,11 @@ EXPORT_SYMBOL(sock_create_lite); /* No kernel lock held - perfect */ static __poll_t sock_poll(struct file *file, poll_table *wait) { - __poll_t busy_flag = 0; - struct socket *sock; - - /* - * We can't return errors to poll, so it's either yes or no. - */ - sock = file->private_data; - - if (sk_can_busy_loop(sock->sk)) { - /* this socket can poll_ll so tell the system call */ - busy_flag = POLL_BUSY_LOOP; - - /* once, only if requested by syscall */ - if (wait && (wait->_key & POLL_BUSY_LOOP)) - sk_busy_loop(sock->sk, 1); - } + struct socket *sock = file->private_data; + __poll_t events = poll_requested_events(wait); - return busy_flag | sock->ops->poll(file, sock, wait); + sock_poll_busy_loop(sock, events); + return sock->ops->poll(file, sock, wait) | sock_poll_busy_flag(sock); } static int sock_mmap(struct file *file, struct vm_area_struct *vma) |