aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-01-30 20:58:07 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-01-30 20:58:07 -0500
commit168fe32a072a4b8dc81a3aebf0e5e588d38e2955 (patch)
tree297f0f6192256785979f5ebfb92797f81754548d /net
parent13ddd1667e7f01071cdf120132238ffca004a88e (diff)
parentc71d227fc4133f949dae620ed5e3a250b43f2415 (diff)
Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull poll annotations from Al Viro: "This introduces a __bitwise type for POLL### bitmap, and propagates the annotations through the tree. Most of that stuff is as simple as 'make ->poll() instances return __poll_t and do the same to local variables used to hold the future return value'. Some of the obvious brainos found in process are fixed (e.g. POLLIN misspelled as POLL_IN). At that point the amount of sparse warnings is low and most of them are for genuine bugs - e.g. ->poll() instance deciding to return -EINVAL instead of a bitmap. I hadn't touched those in this series - it's large enough as it is. Another problem it has caught was eventpoll() ABI mess; select.c and eventpoll.c assumed that corresponding POLL### and EPOLL### were equal. That's true for some, but not all of them - EPOLL### are arch-independent, but POLL### are not. The last commit in this series separates userland POLL### values from the (now arch-independent) kernel-side ones, converting between them in the few places where they are copied to/from userland. AFAICS, this is the least disruptive fix preserving poll(2) ABI and making epoll() work on all architectures. As it is, it's simply broken on sparc - try to give it EPOLLWRNORM and it will trigger only on what would've triggered EPOLLWRBAND on other architectures. EPOLLWRBAND and EPOLLRDHUP, OTOH, are never triggered at all on sparc. With this patch they should work consistently on all architectures" * 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (37 commits) make kernel-side POLL... arch-independent eventpoll: no need to mask the result of epi_item_poll() again eventpoll: constify struct epoll_event pointers debugging printk in sg_poll() uses %x to print POLL... bitmap annotate poll(2) guts 9p: untangle ->poll() mess ->si_band gets POLL... bitmap stored into a user-visible long field ring_buffer_poll_wait() return value used as return value of ->poll() the rest of drivers/*: annotate ->poll() instances media: annotate ->poll() instances fs: annotate ->poll() instances ipc, kernel, mm: annotate ->poll() instances net: annotate ->poll() instances apparmor: annotate ->poll() instances tomoyo: annotate ->poll() instances sound: annotate ->poll() instances acpi: annotate ->poll() instances crypto: annotate ->poll() instances block: annotate ->poll() instances x86: annotate ->poll() instances ...
Diffstat (limited to 'net')
-rw-r--r--net/9p/trans_fd.c60
-rw-r--r--net/atm/common.c4
-rw-r--r--net/atm/common.h2
-rw-r--r--net/batman-adv/icmp_socket.c2
-rw-r--r--net/batman-adv/log.c2
-rw-r--r--net/bluetooth/af_bluetooth.c6
-rw-r--r--net/caif/caif_socket.c4
-rw-r--r--net/core/datagram.c8
-rw-r--r--net/core/sock.c2
-rw-r--r--net/dccp/dccp.h2
-rw-r--r--net/dccp/proto.c4
-rw-r--r--net/decnet/af_decnet.c4
-rw-r--r--net/ipv4/tcp.c4
-rw-r--r--net/ipv4/udp.c4
-rw-r--r--net/iucv/af_iucv.c6
-rw-r--r--net/nfc/llcp_sock.c6
-rw-r--r--net/nfc/nci/uart.c2
-rw-r--r--net/packet/af_packet.c4
-rw-r--r--net/phonet/socket.c4
-rw-r--r--net/rds/af_rds.c4
-rw-r--r--net/rfkill/core.c4
-rw-r--r--net/rxrpc/af_rxrpc.c4
-rw-r--r--net/sctp/socket.c4
-rw-r--r--net/smc/af_smc.c6
-rw-r--r--net/socket.c6
-rw-r--r--net/sunrpc/cache.c8
-rw-r--r--net/sunrpc/rpc_pipe.c4
-rw-r--r--net/tipc/socket.c4
-rw-r--r--net/unix/af_unix.c15
-rw-r--r--net/vmw_vsock/af_vsock.c4
30 files changed, 96 insertions, 97 deletions
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 80f5c79053a4..d6f7f7cb79c4 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -228,32 +228,31 @@ static void p9_conn_cancel(struct p9_conn *m, int err)
228 } 228 }
229} 229}
230 230
231static int 231static __poll_t
232p9_fd_poll(struct p9_client *client, struct poll_table_struct *pt) 232p9_fd_poll(struct p9_client *client, struct poll_table_struct *pt, int *err)
233{ 233{
234 int ret, n; 234 __poll_t ret, n;
235 struct p9_trans_fd *ts = NULL; 235 struct p9_trans_fd *ts = NULL;
236 236
237 if (client && client->status == Connected) 237 if (client && client->status == Connected)
238 ts = client->trans; 238 ts = client->trans;
239 239
240 if (!ts) 240 if (!ts) {
241 return -EREMOTEIO; 241 if (err)
242 *err = -EREMOTEIO;
243 return POLLERR;
244 }
242 245
243 if (!ts->rd->f_op->poll) 246 if (!ts->rd->f_op->poll)
244 return -EIO; 247 ret = DEFAULT_POLLMASK;
245 248 else
246 if (!ts->wr->f_op->poll) 249 ret = ts->rd->f_op->poll(ts->rd, pt);
247 return -EIO;
248
249 ret = ts->rd->f_op->poll(ts->rd, pt);
250 if (ret < 0)
251 return ret;
252 250
253 if (ts->rd != ts->wr) { 251 if (ts->rd != ts->wr) {
254 n = ts->wr->f_op->poll(ts->wr, pt); 252 if (!ts->wr->f_op->poll)
255 if (n < 0) 253 n = DEFAULT_POLLMASK;
256 return n; 254 else
255 n = ts->wr->f_op->poll(ts->wr, pt);
257 ret = (ret & ~POLLOUT) | (n & ~POLLIN); 256 ret = (ret & ~POLLOUT) | (n & ~POLLIN);
258 } 257 }
259 258
@@ -298,7 +297,8 @@ static int p9_fd_read(struct p9_client *client, void *v, int len)
298 297
299static void p9_read_work(struct work_struct *work) 298static void p9_read_work(struct work_struct *work)
300{ 299{
301 int n, err; 300 __poll_t n;
301 int err;
302 struct p9_conn *m; 302 struct p9_conn *m;
303 int status = REQ_STATUS_ERROR; 303 int status = REQ_STATUS_ERROR;
304 304
@@ -398,7 +398,7 @@ end_clear:
398 if (test_and_clear_bit(Rpending, &m->wsched)) 398 if (test_and_clear_bit(Rpending, &m->wsched))
399 n = POLLIN; 399 n = POLLIN;
400 else 400 else
401 n = p9_fd_poll(m->client, NULL); 401 n = p9_fd_poll(m->client, NULL, NULL);
402 402
403 if ((n & POLLIN) && !test_and_set_bit(Rworksched, &m->wsched)) { 403 if ((n & POLLIN) && !test_and_set_bit(Rworksched, &m->wsched)) {
404 p9_debug(P9_DEBUG_TRANS, "sched read work %p\n", m); 404 p9_debug(P9_DEBUG_TRANS, "sched read work %p\n", m);
@@ -448,7 +448,8 @@ static int p9_fd_write(struct p9_client *client, void *v, int len)
448 448
449static void p9_write_work(struct work_struct *work) 449static void p9_write_work(struct work_struct *work)
450{ 450{
451 int n, err; 451 __poll_t n;
452 int err;
452 struct p9_conn *m; 453 struct p9_conn *m;
453 struct p9_req_t *req; 454 struct p9_req_t *req;
454 455
@@ -506,7 +507,7 @@ end_clear:
506 if (test_and_clear_bit(Wpending, &m->wsched)) 507 if (test_and_clear_bit(Wpending, &m->wsched))
507 n = POLLOUT; 508 n = POLLOUT;
508 else 509 else
509 n = p9_fd_poll(m->client, NULL); 510 n = p9_fd_poll(m->client, NULL, NULL);
510 511
511 if ((n & POLLOUT) && 512 if ((n & POLLOUT) &&
512 !test_and_set_bit(Wworksched, &m->wsched)) { 513 !test_and_set_bit(Wworksched, &m->wsched)) {
@@ -581,7 +582,7 @@ p9_pollwait(struct file *filp, wait_queue_head_t *wait_address, poll_table *p)
581 582
582static void p9_conn_create(struct p9_client *client) 583static void p9_conn_create(struct p9_client *client)
583{ 584{
584 int n; 585 __poll_t n;
585 struct p9_trans_fd *ts = client->trans; 586 struct p9_trans_fd *ts = client->trans;
586 struct p9_conn *m = &ts->conn; 587 struct p9_conn *m = &ts->conn;
587 588
@@ -597,7 +598,7 @@ static void p9_conn_create(struct p9_client *client)
597 INIT_LIST_HEAD(&m->poll_pending_link); 598 INIT_LIST_HEAD(&m->poll_pending_link);
598 init_poll_funcptr(&m->pt, p9_pollwait); 599 init_poll_funcptr(&m->pt, p9_pollwait);
599 600
600 n = p9_fd_poll(client, &m->pt); 601 n = p9_fd_poll(client, &m->pt, NULL);
601 if (n & POLLIN) { 602 if (n & POLLIN) {
602 p9_debug(P9_DEBUG_TRANS, "mux %p can read\n", m); 603 p9_debug(P9_DEBUG_TRANS, "mux %p can read\n", m);
603 set_bit(Rpending, &m->wsched); 604 set_bit(Rpending, &m->wsched);
@@ -617,17 +618,16 @@ static void p9_conn_create(struct p9_client *client)
617 618
618static void p9_poll_mux(struct p9_conn *m) 619static void p9_poll_mux(struct p9_conn *m)
619{ 620{
620 int n; 621 __poll_t n;
622 int err = -ECONNRESET;
621 623
622 if (m->err < 0) 624 if (m->err < 0)
623 return; 625 return;
624 626
625 n = p9_fd_poll(m->client, NULL); 627 n = p9_fd_poll(m->client, NULL, &err);
626 if (n < 0 || n & (POLLERR | POLLHUP | POLLNVAL)) { 628 if (n & (POLLERR | POLLHUP | POLLNVAL)) {
627 p9_debug(P9_DEBUG_TRANS, "error mux %p err %d\n", m, n); 629 p9_debug(P9_DEBUG_TRANS, "error mux %p err %d\n", m, n);
628 if (n >= 0) 630 p9_conn_cancel(m, err);
629 n = -ECONNRESET;
630 p9_conn_cancel(m, n);
631 } 631 }
632 632
633 if (n & POLLIN) { 633 if (n & POLLIN) {
@@ -663,7 +663,7 @@ static void p9_poll_mux(struct p9_conn *m)
663 663
664static int p9_fd_request(struct p9_client *client, struct p9_req_t *req) 664static int p9_fd_request(struct p9_client *client, struct p9_req_t *req)
665{ 665{
666 int n; 666 __poll_t n;
667 struct p9_trans_fd *ts = client->trans; 667 struct p9_trans_fd *ts = client->trans;
668 struct p9_conn *m = &ts->conn; 668 struct p9_conn *m = &ts->conn;
669 669
@@ -680,7 +680,7 @@ static int p9_fd_request(struct p9_client *client, struct p9_req_t *req)
680 if (test_and_clear_bit(Wpending, &m->wsched)) 680 if (test_and_clear_bit(Wpending, &m->wsched))
681 n = POLLOUT; 681 n = POLLOUT;
682 else 682 else
683 n = p9_fd_poll(m->client, NULL); 683 n = p9_fd_poll(m->client, NULL, NULL);
684 684
685 if (n & POLLOUT && !test_and_set_bit(Wworksched, &m->wsched)) 685 if (n & POLLOUT && !test_and_set_bit(Wworksched, &m->wsched))
686 schedule_work(&m->wq); 686 schedule_work(&m->wq);
diff --git a/net/atm/common.c b/net/atm/common.c
index 8a4f99114cd2..8f12f1c6fa14 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -648,11 +648,11 @@ out:
648 return error; 648 return error;
649} 649}
650 650
651unsigned int vcc_poll(struct file *file, struct socket *sock, poll_table *wait) 651__poll_t vcc_poll(struct file *file, struct socket *sock, poll_table *wait)
652{ 652{
653 struct sock *sk = sock->sk; 653 struct sock *sk = sock->sk;
654 struct atm_vcc *vcc; 654 struct atm_vcc *vcc;
655 unsigned int mask; 655 __poll_t mask;
656 656
657 sock_poll_wait(file, sk_sleep(sk), wait); 657 sock_poll_wait(file, sk_sleep(sk), wait);
658 mask = 0; 658 mask = 0;
diff --git a/net/atm/common.h b/net/atm/common.h
index d9d583712a91..5850649068bb 100644
--- a/net/atm/common.h
+++ b/net/atm/common.h
@@ -17,7 +17,7 @@ int vcc_connect(struct socket *sock, int itf, short vpi, int vci);
17int vcc_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, 17int vcc_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
18 int flags); 18 int flags);
19int vcc_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len); 19int vcc_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len);
20unsigned int vcc_poll(struct file *file, struct socket *sock, poll_table *wait); 20__poll_t vcc_poll(struct file *file, struct socket *sock, poll_table *wait);
21int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 21int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
22int vcc_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 22int vcc_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
23int vcc_setsockopt(struct socket *sock, int level, int optname, 23int vcc_setsockopt(struct socket *sock, int level, int optname,
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c
index bded31121d12..a98e0a986cef 100644
--- a/net/batman-adv/icmp_socket.c
+++ b/net/batman-adv/icmp_socket.c
@@ -292,7 +292,7 @@ out:
292 return len; 292 return len;
293} 293}
294 294
295static unsigned int batadv_socket_poll(struct file *file, poll_table *wait) 295static __poll_t batadv_socket_poll(struct file *file, poll_table *wait)
296{ 296{
297 struct batadv_socket_client *socket_client = file->private_data; 297 struct batadv_socket_client *socket_client = file->private_data;
298 298
diff --git a/net/batman-adv/log.c b/net/batman-adv/log.c
index 4ef4bde2cc2d..76451460c98d 100644
--- a/net/batman-adv/log.c
+++ b/net/batman-adv/log.c
@@ -176,7 +176,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf,
176 return error; 176 return error;
177} 177}
178 178
179static unsigned int batadv_log_poll(struct file *file, poll_table *wait) 179static __poll_t batadv_log_poll(struct file *file, poll_table *wait)
180{ 180{
181 struct batadv_priv *bat_priv = file->private_data; 181 struct batadv_priv *bat_priv = file->private_data;
182 struct batadv_priv_debug_log *debug_log = bat_priv->debug_log; 182 struct batadv_priv_debug_log *debug_log = bat_priv->debug_log;
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index 91e3ba280706..671b907ba678 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -421,7 +421,7 @@ out:
421} 421}
422EXPORT_SYMBOL(bt_sock_stream_recvmsg); 422EXPORT_SYMBOL(bt_sock_stream_recvmsg);
423 423
424static inline unsigned int bt_accept_poll(struct sock *parent) 424static inline __poll_t bt_accept_poll(struct sock *parent)
425{ 425{
426 struct bt_sock *s, *n; 426 struct bt_sock *s, *n;
427 struct sock *sk; 427 struct sock *sk;
@@ -437,11 +437,11 @@ static inline unsigned int bt_accept_poll(struct sock *parent)
437 return 0; 437 return 0;
438} 438}
439 439
440unsigned int bt_sock_poll(struct file *file, struct socket *sock, 440__poll_t bt_sock_poll(struct file *file, struct socket *sock,
441 poll_table *wait) 441 poll_table *wait)
442{ 442{
443 struct sock *sk = sock->sk; 443 struct sock *sk = sock->sk;
444 unsigned int mask = 0; 444 __poll_t mask = 0;
445 445
446 BT_DBG("sock %p, sk %p", sock, sk); 446 BT_DBG("sock %p, sk %p", sock, sk);
447 447
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index 632d5a416d97..64048cec41e0 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -934,11 +934,11 @@ static int caif_release(struct socket *sock)
934} 934}
935 935
936/* Copied from af_unix.c:unix_poll(), added CAIF tx_flow handling */ 936/* Copied from af_unix.c:unix_poll(), added CAIF tx_flow handling */
937static unsigned int caif_poll(struct file *file, 937static __poll_t caif_poll(struct file *file,
938 struct socket *sock, poll_table *wait) 938 struct socket *sock, poll_table *wait)
939{ 939{
940 struct sock *sk = sock->sk; 940 struct sock *sk = sock->sk;
941 unsigned int mask; 941 __poll_t mask;
942 struct caifsock *cf_sk = container_of(sk, struct caifsock, sk); 942 struct caifsock *cf_sk = container_of(sk, struct caifsock, sk);
943 943
944 sock_poll_wait(file, sk_sleep(sk), wait); 944 sock_poll_wait(file, sk_sleep(sk), wait);
diff --git a/net/core/datagram.c b/net/core/datagram.c
index 522873ed120b..b7d9293940b5 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -72,12 +72,10 @@ static inline int connection_based(struct sock *sk)
72static int receiver_wake_function(wait_queue_entry_t *wait, unsigned int mode, int sync, 72static int receiver_wake_function(wait_queue_entry_t *wait, unsigned int mode, int sync,
73 void *key) 73 void *key)
74{ 74{
75 unsigned long bits = (unsigned long)key;
76
77 /* 75 /*
78 * Avoid a wakeup if event not interesting for us 76 * Avoid a wakeup if event not interesting for us
79 */ 77 */
80 if (bits && !(bits & (POLLIN | POLLERR))) 78 if (key && !(key_to_poll(key) & (POLLIN | POLLERR)))
81 return 0; 79 return 0;
82 return autoremove_wake_function(wait, mode, sync, key); 80 return autoremove_wake_function(wait, mode, sync, key);
83} 81}
@@ -833,11 +831,11 @@ EXPORT_SYMBOL(skb_copy_and_csum_datagram_msg);
833 * and you use a different write policy from sock_writeable() 831 * and you use a different write policy from sock_writeable()
834 * then please supply your own write_space callback. 832 * then please supply your own write_space callback.
835 */ 833 */
836unsigned int datagram_poll(struct file *file, struct socket *sock, 834__poll_t datagram_poll(struct file *file, struct socket *sock,
837 poll_table *wait) 835 poll_table *wait)
838{ 836{
839 struct sock *sk = sock->sk; 837 struct sock *sk = sock->sk;
840 unsigned int mask; 838 __poll_t mask;
841 839
842 sock_poll_wait(file, sk_sleep(sk), wait); 840 sock_poll_wait(file, sk_sleep(sk), wait);
843 mask = 0; 841 mask = 0;
diff --git a/net/core/sock.c b/net/core/sock.c
index c0b5b2f17412..1211159718ad 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2496,7 +2496,7 @@ int sock_no_getname(struct socket *sock, struct sockaddr *saddr,
2496} 2496}
2497EXPORT_SYMBOL(sock_no_getname); 2497EXPORT_SYMBOL(sock_no_getname);
2498 2498
2499unsigned int sock_no_poll(struct file *file, struct socket *sock, poll_table *pt) 2499__poll_t sock_no_poll(struct file *file, struct socket *sock, poll_table *pt)
2500{ 2500{
2501 return 0; 2501 return 0;
2502} 2502}
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index 0c55ffb859bf..f91e3816806b 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -316,7 +316,7 @@ int dccp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
316 int flags, int *addr_len); 316 int flags, int *addr_len);
317void dccp_shutdown(struct sock *sk, int how); 317void dccp_shutdown(struct sock *sk, int how);
318int inet_dccp_listen(struct socket *sock, int backlog); 318int inet_dccp_listen(struct socket *sock, int backlog);
319unsigned int dccp_poll(struct file *file, struct socket *sock, 319__poll_t dccp_poll(struct file *file, struct socket *sock,
320 poll_table *wait); 320 poll_table *wait);
321int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len); 321int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
322void dccp_req_err(struct sock *sk, u64 seq); 322void dccp_req_err(struct sock *sk, u64 seq);
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 9d43c1f40274..8b8db3d481bd 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -318,10 +318,10 @@ EXPORT_SYMBOL_GPL(dccp_disconnect);
318 * take care of normal races (between the test and the event) and we don't 318 * take care of normal races (between the test and the event) and we don't
319 * go look at any of the socket buffers directly. 319 * go look at any of the socket buffers directly.
320 */ 320 */
321unsigned int dccp_poll(struct file *file, struct socket *sock, 321__poll_t dccp_poll(struct file *file, struct socket *sock,
322 poll_table *wait) 322 poll_table *wait)
323{ 323{
324 unsigned int mask; 324 __poll_t mask;
325 struct sock *sk = sock->sk; 325 struct sock *sk = sock->sk;
326 326
327 sock_poll_wait(file, sk_sleep(sk), wait); 327 sock_poll_wait(file, sk_sleep(sk), wait);
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 518cea17b811..9c2dde819817 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -1209,11 +1209,11 @@ static int dn_getname(struct socket *sock, struct sockaddr *uaddr,int *uaddr_len
1209} 1209}
1210 1210
1211 1211
1212static unsigned int dn_poll(struct file *file, struct socket *sock, poll_table *wait) 1212static __poll_t dn_poll(struct file *file, struct socket *sock, poll_table *wait)
1213{ 1213{
1214 struct sock *sk = sock->sk; 1214 struct sock *sk = sock->sk;
1215 struct dn_scp *scp = DN_SK(sk); 1215 struct dn_scp *scp = DN_SK(sk);
1216 int mask = datagram_poll(file, sock, wait); 1216 __poll_t mask = datagram_poll(file, sock, wait);
1217 1217
1218 if (!skb_queue_empty(&scp->other_receive_queue)) 1218 if (!skb_queue_empty(&scp->other_receive_queue))
1219 mask |= POLLRDBAND; 1219 mask |= POLLRDBAND;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 8e053ad7cae2..1b38b4282cc9 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -493,9 +493,9 @@ static void tcp_tx_timestamp(struct sock *sk, u16 tsflags)
493 * take care of normal races (between the test and the event) and we don't 493 * take care of normal races (between the test and the event) and we don't
494 * go look at any of the socket buffers directly. 494 * go look at any of the socket buffers directly.
495 */ 495 */
496unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait) 496__poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
497{ 497{
498 unsigned int mask; 498 __poll_t mask;
499 struct sock *sk = sock->sk; 499 struct sock *sk = sock->sk;
500 const struct tcp_sock *tp = tcp_sk(sk); 500 const struct tcp_sock *tp = tcp_sk(sk);
501 int state; 501 int state;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index e4ff25c947c5..ef45adfc0edb 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2502,9 +2502,9 @@ int compat_udp_getsockopt(struct sock *sk, int level, int optname,
2502 * but then block when reading it. Add special case code 2502 * but then block when reading it. Add special case code
2503 * to work around these arguably broken applications. 2503 * to work around these arguably broken applications.
2504 */ 2504 */
2505unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait) 2505__poll_t udp_poll(struct file *file, struct socket *sock, poll_table *wait)
2506{ 2506{
2507 unsigned int mask = datagram_poll(file, sock, wait); 2507 __poll_t mask = datagram_poll(file, sock, wait);
2508 struct sock *sk = sock->sk; 2508 struct sock *sk = sock->sk;
2509 2509
2510 if (!skb_queue_empty(&udp_sk(sk)->reader_queue)) 2510 if (!skb_queue_empty(&udp_sk(sk)->reader_queue))
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 148533169b1d..64331158d693 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -1474,7 +1474,7 @@ done:
1474 return copied; 1474 return copied;
1475} 1475}
1476 1476
1477static inline unsigned int iucv_accept_poll(struct sock *parent) 1477static inline __poll_t iucv_accept_poll(struct sock *parent)
1478{ 1478{
1479 struct iucv_sock *isk, *n; 1479 struct iucv_sock *isk, *n;
1480 struct sock *sk; 1480 struct sock *sk;
@@ -1489,11 +1489,11 @@ static inline unsigned int iucv_accept_poll(struct sock *parent)
1489 return 0; 1489 return 0;
1490} 1490}
1491 1491
1492unsigned int iucv_sock_poll(struct file *file, struct socket *sock, 1492__poll_t iucv_sock_poll(struct file *file, struct socket *sock,
1493 poll_table *wait) 1493 poll_table *wait)
1494{ 1494{
1495 struct sock *sk = sock->sk; 1495 struct sock *sk = sock->sk;
1496 unsigned int mask = 0; 1496 __poll_t mask = 0;
1497 1497
1498 sock_poll_wait(file, sk_sleep(sk), wait); 1498 sock_poll_wait(file, sk_sleep(sk), wait);
1499 1499
diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
index fb7afcaa3004..985909f105eb 100644
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -531,7 +531,7 @@ static int llcp_sock_getname(struct socket *sock, struct sockaddr *uaddr,
531 return 0; 531 return 0;
532} 532}
533 533
534static inline unsigned int llcp_accept_poll(struct sock *parent) 534static inline __poll_t llcp_accept_poll(struct sock *parent)
535{ 535{
536 struct nfc_llcp_sock *llcp_sock, *parent_sock; 536 struct nfc_llcp_sock *llcp_sock, *parent_sock;
537 struct sock *sk; 537 struct sock *sk;
@@ -549,11 +549,11 @@ static inline unsigned int llcp_accept_poll(struct sock *parent)
549 return 0; 549 return 0;
550} 550}
551 551
552static unsigned int llcp_sock_poll(struct file *file, struct socket *sock, 552static __poll_t llcp_sock_poll(struct file *file, struct socket *sock,
553 poll_table *wait) 553 poll_table *wait)
554{ 554{
555 struct sock *sk = sock->sk; 555 struct sock *sk = sock->sk;
556 unsigned int mask = 0; 556 __poll_t mask = 0;
557 557
558 pr_debug("%p\n", sk); 558 pr_debug("%p\n", sk);
559 559
diff --git a/net/nfc/nci/uart.c b/net/nfc/nci/uart.c
index 8d104c1db628..a66f102c6c01 100644
--- a/net/nfc/nci/uart.c
+++ b/net/nfc/nci/uart.c
@@ -305,7 +305,7 @@ static ssize_t nci_uart_tty_write(struct tty_struct *tty, struct file *file,
305 return 0; 305 return 0;
306} 306}
307 307
308static unsigned int nci_uart_tty_poll(struct tty_struct *tty, 308static __poll_t nci_uart_tty_poll(struct tty_struct *tty,
309 struct file *filp, poll_table *wait) 309 struct file *filp, poll_table *wait)
310{ 310{
311 return 0; 311 return 0;
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index da215e5c1399..3b4d6a3cf190 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -4073,12 +4073,12 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,
4073 return 0; 4073 return 0;
4074} 4074}
4075 4075
4076static unsigned int packet_poll(struct file *file, struct socket *sock, 4076static __poll_t packet_poll(struct file *file, struct socket *sock,
4077 poll_table *wait) 4077 poll_table *wait)
4078{ 4078{
4079 struct sock *sk = sock->sk; 4079 struct sock *sk = sock->sk;
4080 struct packet_sock *po = pkt_sk(sk); 4080 struct packet_sock *po = pkt_sk(sk);
4081 unsigned int mask = datagram_poll(file, sock, wait); 4081 __poll_t mask = datagram_poll(file, sock, wait);
4082 4082
4083 spin_lock_bh(&sk->sk_receive_queue.lock); 4083 spin_lock_bh(&sk->sk_receive_queue.lock);
4084 if (po->rx_ring.pg_vec) { 4084 if (po->rx_ring.pg_vec) {
diff --git a/net/phonet/socket.c b/net/phonet/socket.c
index 1b050dd17393..44417480dab7 100644
--- a/net/phonet/socket.c
+++ b/net/phonet/socket.c
@@ -341,12 +341,12 @@ static int pn_socket_getname(struct socket *sock, struct sockaddr *addr,
341 return 0; 341 return 0;
342} 342}
343 343
344static unsigned int pn_socket_poll(struct file *file, struct socket *sock, 344static __poll_t pn_socket_poll(struct file *file, struct socket *sock,
345 poll_table *wait) 345 poll_table *wait)
346{ 346{
347 struct sock *sk = sock->sk; 347 struct sock *sk = sock->sk;
348 struct pep_sock *pn = pep_sk(sk); 348 struct pep_sock *pn = pep_sk(sk);
349 unsigned int mask = 0; 349 __poll_t mask = 0;
350 350
351 poll_wait(file, sk_sleep(sk), wait); 351 poll_wait(file, sk_sleep(sk), wait);
352 352
diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c
index b405f77d664c..88aa8ad0f5b6 100644
--- a/net/rds/af_rds.c
+++ b/net/rds/af_rds.c
@@ -152,12 +152,12 @@ static int rds_getname(struct socket *sock, struct sockaddr *uaddr,
152 * to send to a congested destination, the system call may still fail (and 152 * to send to a congested destination, the system call may still fail (and
153 * return ENOBUFS). 153 * return ENOBUFS).
154 */ 154 */
155static unsigned int rds_poll(struct file *file, struct socket *sock, 155static __poll_t rds_poll(struct file *file, struct socket *sock,
156 poll_table *wait) 156 poll_table *wait)
157{ 157{
158 struct sock *sk = sock->sk; 158 struct sock *sk = sock->sk;
159 struct rds_sock *rs = rds_sk_to_rs(sk); 159 struct rds_sock *rs = rds_sk_to_rs(sk);
160 unsigned int mask = 0; 160 __poll_t mask = 0;
161 unsigned long flags; 161 unsigned long flags;
162 162
163 poll_wait(file, sk_sleep(sk), wait); 163 poll_wait(file, sk_sleep(sk), wait);
diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index 2064c3a35ef8..124c77e9d058 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -1139,10 +1139,10 @@ static int rfkill_fop_open(struct inode *inode, struct file *file)
1139 return -ENOMEM; 1139 return -ENOMEM;
1140} 1140}
1141 1141
1142static unsigned int rfkill_fop_poll(struct file *file, poll_table *wait) 1142static __poll_t rfkill_fop_poll(struct file *file, poll_table *wait)
1143{ 1143{
1144 struct rfkill_data *data = file->private_data; 1144 struct rfkill_data *data = file->private_data;
1145 unsigned int res = POLLOUT | POLLWRNORM; 1145 __poll_t res = POLLOUT | POLLWRNORM;
1146 1146
1147 poll_wait(file, &data->read_wait, wait); 1147 poll_wait(file, &data->read_wait, wait);
1148 1148
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index dcd818fa837e..21ad6a3a465c 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -729,12 +729,12 @@ static int rxrpc_getsockopt(struct socket *sock, int level, int optname,
729/* 729/*
730 * permit an RxRPC socket to be polled 730 * permit an RxRPC socket to be polled
731 */ 731 */
732static unsigned int rxrpc_poll(struct file *file, struct socket *sock, 732static __poll_t rxrpc_poll(struct file *file, struct socket *sock,
733 poll_table *wait) 733 poll_table *wait)
734{ 734{
735 struct sock *sk = sock->sk; 735 struct sock *sk = sock->sk;
736 struct rxrpc_sock *rx = rxrpc_sk(sk); 736 struct rxrpc_sock *rx = rxrpc_sk(sk);
737 unsigned int mask; 737 __poll_t mask;
738 738
739 sock_poll_wait(file, sk_sleep(sk), wait); 739 sock_poll_wait(file, sk_sleep(sk), wait);
740 mask = 0; 740 mask = 0;
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 039fcb618c34..37382317fba4 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -7518,11 +7518,11 @@ out:
7518 * here, again, by modeling the current TCP/UDP code. We don't have 7518 * here, again, by modeling the current TCP/UDP code. We don't have
7519 * a good way to test with it yet. 7519 * a good way to test with it yet.
7520 */ 7520 */
7521unsigned int sctp_poll(struct file *file, struct socket *sock, poll_table *wait) 7521__poll_t sctp_poll(struct file *file, struct socket *sock, poll_table *wait)
7522{ 7522{
7523 struct sock *sk = sock->sk; 7523 struct sock *sk = sock->sk;
7524 struct sctp_sock *sp = sctp_sk(sk); 7524 struct sctp_sock *sp = sctp_sk(sk);
7525 unsigned int mask; 7525 __poll_t mask;
7526 7526
7527 poll_wait(file, sk_sleep(sk), wait); 7527 poll_wait(file, sk_sleep(sk), wait);
7528 7528
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 6451c5013e06..449f62e1e270 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1107,7 +1107,7 @@ out:
1107 return rc; 1107 return rc;
1108} 1108}
1109 1109
1110static unsigned int smc_accept_poll(struct sock *parent) 1110static __poll_t smc_accept_poll(struct sock *parent)
1111{ 1111{
1112 struct smc_sock *isk; 1112 struct smc_sock *isk;
1113 struct sock *sk; 1113 struct sock *sk;
@@ -1126,11 +1126,11 @@ static unsigned int smc_accept_poll(struct sock *parent)
1126 return 0; 1126 return 0;
1127} 1127}
1128 1128
1129static unsigned int smc_poll(struct file *file, struct socket *sock, 1129static __poll_t smc_poll(struct file *file, struct socket *sock,
1130 poll_table *wait) 1130 poll_table *wait)
1131{ 1131{
1132 struct sock *sk = sock->sk; 1132 struct sock *sk = sock->sk;
1133 unsigned int mask = 0; 1133 __poll_t mask = 0;
1134 struct smc_sock *smc; 1134 struct smc_sock *smc;
1135 int rc; 1135 int rc;
1136 1136
diff --git a/net/socket.c b/net/socket.c
index 6f05d5c4bf30..2f378449bc1b 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -118,7 +118,7 @@ static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from);
118static int sock_mmap(struct file *file, struct vm_area_struct *vma); 118static int sock_mmap(struct file *file, struct vm_area_struct *vma);
119 119
120static int sock_close(struct inode *inode, struct file *file); 120static int sock_close(struct inode *inode, struct file *file);
121static unsigned int sock_poll(struct file *file, 121static __poll_t sock_poll(struct file *file,
122 struct poll_table_struct *wait); 122 struct poll_table_struct *wait);
123static long sock_ioctl(struct file *file, unsigned int cmd, unsigned long arg); 123static long sock_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
124#ifdef CONFIG_COMPAT 124#ifdef CONFIG_COMPAT
@@ -1097,9 +1097,9 @@ out_release:
1097EXPORT_SYMBOL(sock_create_lite); 1097EXPORT_SYMBOL(sock_create_lite);
1098 1098
1099/* No kernel lock held - perfect */ 1099/* No kernel lock held - perfect */
1100static unsigned int sock_poll(struct file *file, poll_table *wait) 1100static __poll_t sock_poll(struct file *file, poll_table *wait)
1101{ 1101{
1102 unsigned int busy_flag = 0; 1102 __poll_t busy_flag = 0;
1103 struct socket *sock; 1103 struct socket *sock;
1104 1104
1105 /* 1105 /*
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index e68943895be4..aa36dad32db1 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -930,10 +930,10 @@ out:
930 930
931static DECLARE_WAIT_QUEUE_HEAD(queue_wait); 931static DECLARE_WAIT_QUEUE_HEAD(queue_wait);
932 932
933static unsigned int cache_poll(struct file *filp, poll_table *wait, 933static __poll_t cache_poll(struct file *filp, poll_table *wait,
934 struct cache_detail *cd) 934 struct cache_detail *cd)
935{ 935{
936 unsigned int mask; 936 __poll_t mask;
937 struct cache_reader *rp = filp->private_data; 937 struct cache_reader *rp = filp->private_data;
938 struct cache_queue *cq; 938 struct cache_queue *cq;
939 939
@@ -1501,7 +1501,7 @@ static ssize_t cache_write_procfs(struct file *filp, const char __user *buf,
1501 return cache_write(filp, buf, count, ppos, cd); 1501 return cache_write(filp, buf, count, ppos, cd);
1502} 1502}
1503 1503
1504static unsigned int cache_poll_procfs(struct file *filp, poll_table *wait) 1504static __poll_t cache_poll_procfs(struct file *filp, poll_table *wait)
1505{ 1505{
1506 struct cache_detail *cd = PDE_DATA(file_inode(filp)); 1506 struct cache_detail *cd = PDE_DATA(file_inode(filp));
1507 1507
@@ -1720,7 +1720,7 @@ static ssize_t cache_write_pipefs(struct file *filp, const char __user *buf,
1720 return cache_write(filp, buf, count, ppos, cd); 1720 return cache_write(filp, buf, count, ppos, cd);
1721} 1721}
1722 1722
1723static unsigned int cache_poll_pipefs(struct file *filp, poll_table *wait) 1723static __poll_t cache_poll_pipefs(struct file *filp, poll_table *wait)
1724{ 1724{
1725 struct cache_detail *cd = RPC_I(file_inode(filp))->private; 1725 struct cache_detail *cd = RPC_I(file_inode(filp))->private;
1726 1726
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 7803f3b6aa53..5c4330325787 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -340,12 +340,12 @@ rpc_pipe_write(struct file *filp, const char __user *buf, size_t len, loff_t *of
340 return res; 340 return res;
341} 341}
342 342
343static unsigned int 343static __poll_t
344rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait) 344rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait)
345{ 345{
346 struct inode *inode = file_inode(filp); 346 struct inode *inode = file_inode(filp);
347 struct rpc_inode *rpci = RPC_I(inode); 347 struct rpc_inode *rpci = RPC_I(inode);
348 unsigned int mask = POLLOUT | POLLWRNORM; 348 __poll_t mask = POLLOUT | POLLWRNORM;
349 349
350 poll_wait(filp, &rpci->waitq, wait); 350 poll_wait(filp, &rpci->waitq, wait);
351 351
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 3b4084480377..2aa46e8cd8fe 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -710,13 +710,13 @@ static int tipc_getname(struct socket *sock, struct sockaddr *uaddr,
710 * imply that the operation will succeed, merely that it should be performed 710 * imply that the operation will succeed, merely that it should be performed
711 * and will not block. 711 * and will not block.
712 */ 712 */
713static unsigned int tipc_poll(struct file *file, struct socket *sock, 713static __poll_t tipc_poll(struct file *file, struct socket *sock,
714 poll_table *wait) 714 poll_table *wait)
715{ 715{
716 struct sock *sk = sock->sk; 716 struct sock *sk = sock->sk;
717 struct tipc_sock *tsk = tipc_sk(sk); 717 struct tipc_sock *tsk = tipc_sk(sk);
718 struct tipc_group *grp = tsk->group; 718 struct tipc_group *grp = tsk->group;
719 u32 revents = 0; 719 __poll_t revents = 0;
720 720
721 sock_poll_wait(file, sk_sleep(sk), wait); 721 sock_poll_wait(file, sk_sleep(sk), wait);
722 722
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index a9ee634f3c42..6b7678df41e5 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -367,7 +367,7 @@ static int unix_dgram_peer_wake_relay(wait_queue_entry_t *q, unsigned mode, int
367 /* relaying can only happen while the wq still exists */ 367 /* relaying can only happen while the wq still exists */
368 u_sleep = sk_sleep(&u->sk); 368 u_sleep = sk_sleep(&u->sk);
369 if (u_sleep) 369 if (u_sleep)
370 wake_up_interruptible_poll(u_sleep, key); 370 wake_up_interruptible_poll(u_sleep, key_to_poll(key));
371 371
372 return 0; 372 return 0;
373} 373}
@@ -638,8 +638,8 @@ static int unix_stream_connect(struct socket *, struct sockaddr *,
638static int unix_socketpair(struct socket *, struct socket *); 638static int unix_socketpair(struct socket *, struct socket *);
639static int unix_accept(struct socket *, struct socket *, int, bool); 639static int unix_accept(struct socket *, struct socket *, int, bool);
640static int unix_getname(struct socket *, struct sockaddr *, int *, int); 640static int unix_getname(struct socket *, struct sockaddr *, int *, int);
641static unsigned int unix_poll(struct file *, struct socket *, poll_table *); 641static __poll_t unix_poll(struct file *, struct socket *, poll_table *);
642static unsigned int unix_dgram_poll(struct file *, struct socket *, 642static __poll_t unix_dgram_poll(struct file *, struct socket *,
643 poll_table *); 643 poll_table *);
644static int unix_ioctl(struct socket *, unsigned int, unsigned long); 644static int unix_ioctl(struct socket *, unsigned int, unsigned long);
645static int unix_shutdown(struct socket *, int); 645static int unix_shutdown(struct socket *, int);
@@ -2640,10 +2640,10 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
2640 return err; 2640 return err;
2641} 2641}
2642 2642
2643static unsigned int unix_poll(struct file *file, struct socket *sock, poll_table *wait) 2643static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wait)
2644{ 2644{
2645 struct sock *sk = sock->sk; 2645 struct sock *sk = sock->sk;
2646 unsigned int mask; 2646 __poll_t mask;
2647 2647
2648 sock_poll_wait(file, sk_sleep(sk), wait); 2648 sock_poll_wait(file, sk_sleep(sk), wait);
2649 mask = 0; 2649 mask = 0;
@@ -2675,11 +2675,12 @@ static unsigned int unix_poll(struct file *file, struct socket *sock, poll_table
2675 return mask; 2675 return mask;
2676} 2676}
2677 2677
2678static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, 2678static __poll_t unix_dgram_poll(struct file *file, struct socket *sock,
2679 poll_table *wait) 2679 poll_table *wait)
2680{ 2680{
2681 struct sock *sk = sock->sk, *other; 2681 struct sock *sk = sock->sk, *other;
2682 unsigned int mask, writable; 2682 unsigned int writable;
2683 __poll_t mask;
2683 2684
2684 sock_poll_wait(file, sk_sleep(sk), wait); 2685 sock_poll_wait(file, sk_sleep(sk), wait);
2685 mask = 0; 2686 mask = 0;
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index c9473d698525..9d95e773f4c8 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -850,11 +850,11 @@ static int vsock_shutdown(struct socket *sock, int mode)
850 return err; 850 return err;
851} 851}
852 852
853static unsigned int vsock_poll(struct file *file, struct socket *sock, 853static __poll_t vsock_poll(struct file *file, struct socket *sock,
854 poll_table *wait) 854 poll_table *wait)
855{ 855{
856 struct sock *sk; 856 struct sock *sk;
857 unsigned int mask; 857 __poll_t mask;
858 struct vsock_sock *vsk; 858 struct vsock_sock *vsk;
859 859
860 sk = sock->sk; 860 sk = sock->sk;