summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-07-30 03:42:10 -0400
committerDavid S. Miller <davem@davemloft.net>2018-07-30 12:10:25 -0400
commitdd979b4df817e9976f18fb6f9d134d6bc4a3c317 (patch)
treefffcfba952d7c3d86fbecaf5a14a213bd0d54967
parent3f6bcc5162a1ba4e99e867364919168c1d821308 (diff)
net: simplify sock_poll_wait
The wait_address argument is always directly derived from the filp argument, so remove it. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--crypto/af_alg.c2
-rw-r--r--include/net/sock.h11
-rw-r--r--net/atm/common.c2
-rw-r--r--net/caif/caif_socket.c2
-rw-r--r--net/core/datagram.c2
-rw-r--r--net/dccp/proto.c2
-rw-r--r--net/ipv4/tcp.c2
-rw-r--r--net/iucv/af_iucv.c2
-rw-r--r--net/nfc/llcp_sock.c2
-rw-r--r--net/rxrpc/af_rxrpc.c2
-rw-r--r--net/smc/af_smc.c2
-rw-r--r--net/tipc/socket.c2
-rw-r--r--net/unix/af_unix.c4
13 files changed, 19 insertions, 18 deletions
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index c166f424871c..b053179e0bc5 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -1071,7 +1071,7 @@ __poll_t af_alg_poll(struct file *file, struct socket *sock,
1071 struct af_alg_ctx *ctx = ask->private; 1071 struct af_alg_ctx *ctx = ask->private;
1072 __poll_t mask; 1072 __poll_t mask;
1073 1073
1074 sock_poll_wait(file, sk_sleep(sk), wait); 1074 sock_poll_wait(file, wait);
1075 mask = 0; 1075 mask = 0;
1076 1076
1077 if (!ctx->more || ctx->used) 1077 if (!ctx->more || ctx->used)
diff --git a/include/net/sock.h b/include/net/sock.h
index 83b747538bd0..0518f61926ec 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2057,16 +2057,17 @@ static inline bool skwq_has_sleeper(struct socket_wq *wq)
2057/** 2057/**
2058 * sock_poll_wait - place memory barrier behind the poll_wait call. 2058 * sock_poll_wait - place memory barrier behind the poll_wait call.
2059 * @filp: file 2059 * @filp: file
2060 * @wait_address: socket wait queue
2061 * @p: poll_table 2060 * @p: poll_table
2062 * 2061 *
2063 * See the comments in the wq_has_sleeper function. 2062 * See the comments in the wq_has_sleeper function.
2064 */ 2063 */
2065static inline void sock_poll_wait(struct file *filp, 2064static inline void sock_poll_wait(struct file *filp, poll_table *p)
2066 wait_queue_head_t *wait_address, poll_table *p)
2067{ 2065{
2068 if (!poll_does_not_wait(p) && wait_address) { 2066 struct socket *sock = filp->private_data;
2069 poll_wait(filp, wait_address, p); 2067 wait_queue_head_t *wq = sk_sleep(sock->sk);
2068
2069 if (!poll_does_not_wait(p) && wq) {
2070 poll_wait(filp, wq, p);
2070 /* We need to be sure we are in sync with the 2071 /* We need to be sure we are in sync with the
2071 * socket flags modification. 2072 * socket flags modification.
2072 * 2073 *
diff --git a/net/atm/common.c b/net/atm/common.c
index a7a68e509628..9f8cb0d2e71e 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -653,7 +653,7 @@ __poll_t vcc_poll(struct file *file, struct socket *sock, poll_table *wait)
653 struct atm_vcc *vcc; 653 struct atm_vcc *vcc;
654 __poll_t mask; 654 __poll_t mask;
655 655
656 sock_poll_wait(file, sk_sleep(sk), wait); 656 sock_poll_wait(file, wait);
657 mask = 0; 657 mask = 0;
658 658
659 vcc = ATM_SD(sock); 659 vcc = ATM_SD(sock);
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index a6fb1b3bcad9..d18965f3291f 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -941,7 +941,7 @@ static __poll_t caif_poll(struct file *file,
941 __poll_t 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, wait);
945 mask = 0; 945 mask = 0;
946 946
947 /* exceptional events? */ 947 /* exceptional events? */
diff --git a/net/core/datagram.c b/net/core/datagram.c
index 9938952c5c78..9aac0d63d53e 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -837,7 +837,7 @@ __poll_t datagram_poll(struct file *file, struct socket *sock,
837 struct sock *sk = sock->sk; 837 struct sock *sk = sock->sk;
838 __poll_t mask; 838 __poll_t mask;
839 839
840 sock_poll_wait(file, sk_sleep(sk), wait); 840 sock_poll_wait(file, wait);
841 mask = 0; 841 mask = 0;
842 842
843 /* exceptional events? */ 843 /* exceptional events? */
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 0d56e36a6db7..875858c8b059 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -325,7 +325,7 @@ __poll_t dccp_poll(struct file *file, struct socket *sock,
325 __poll_t mask; 325 __poll_t mask;
326 struct sock *sk = sock->sk; 326 struct sock *sk = sock->sk;
327 327
328 sock_poll_wait(file, sk_sleep(sk), wait); 328 sock_poll_wait(file, wait);
329 if (sk->sk_state == DCCP_LISTEN) 329 if (sk->sk_state == DCCP_LISTEN)
330 return inet_csk_listen_poll(sk); 330 return inet_csk_listen_poll(sk);
331 331
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 514aaac1626f..f3bfb9f29520 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -507,7 +507,7 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
507 const struct tcp_sock *tp = tcp_sk(sk); 507 const struct tcp_sock *tp = tcp_sk(sk);
508 int state; 508 int state;
509 509
510 sock_poll_wait(file, sk_sleep(sk), wait); 510 sock_poll_wait(file, wait);
511 511
512 state = inet_sk_state_load(sk); 512 state = inet_sk_state_load(sk);
513 if (state == TCP_LISTEN) 513 if (state == TCP_LISTEN)
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 8d1c43f8fed4..92ee91e34395 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -1494,7 +1494,7 @@ __poll_t iucv_sock_poll(struct file *file, struct socket *sock,
1494 struct sock *sk = sock->sk; 1494 struct sock *sk = sock->sk;
1495 __poll_t mask = 0; 1495 __poll_t mask = 0;
1496 1496
1497 sock_poll_wait(file, sk_sleep(sk), wait); 1497 sock_poll_wait(file, wait);
1498 1498
1499 if (sk->sk_state == IUCV_LISTEN) 1499 if (sk->sk_state == IUCV_LISTEN)
1500 return iucv_accept_poll(sk); 1500 return iucv_accept_poll(sk);
diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
index ea0c0c6f1874..dd4adf8b1167 100644
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -556,7 +556,7 @@ static __poll_t llcp_sock_poll(struct file *file, struct socket *sock,
556 556
557 pr_debug("%p\n", sk); 557 pr_debug("%p\n", sk);
558 558
559 sock_poll_wait(file, sk_sleep(sk), wait); 559 sock_poll_wait(file, wait);
560 560
561 if (sk->sk_state == LLCP_LISTEN) 561 if (sk->sk_state == LLCP_LISTEN)
562 return llcp_accept_poll(sk); 562 return llcp_accept_poll(sk);
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index 2b463047dd7b..ac44d8afffb1 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -741,7 +741,7 @@ static __poll_t rxrpc_poll(struct file *file, struct socket *sock,
741 struct rxrpc_sock *rx = rxrpc_sk(sk); 741 struct rxrpc_sock *rx = rxrpc_sk(sk);
742 __poll_t mask; 742 __poll_t mask;
743 743
744 sock_poll_wait(file, sk_sleep(sk), wait); 744 sock_poll_wait(file, wait);
745 mask = 0; 745 mask = 0;
746 746
747 /* the socket is readable if there are any messages waiting on the Rx 747 /* the socket is readable if there are any messages waiting on the Rx
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index fce7e4751151..0fc94f296e54 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1535,7 +1535,7 @@ static __poll_t smc_poll(struct file *file, struct socket *sock,
1535 mask |= EPOLLERR; 1535 mask |= EPOLLERR;
1536 } else { 1536 } else {
1537 if (sk->sk_state != SMC_CLOSED) 1537 if (sk->sk_state != SMC_CLOSED)
1538 sock_poll_wait(file, sk_sleep(sk), wait); 1538 sock_poll_wait(file, wait);
1539 if (sk->sk_err) 1539 if (sk->sk_err)
1540 mask |= EPOLLERR; 1540 mask |= EPOLLERR;
1541 if ((sk->sk_shutdown == SHUTDOWN_MASK) || 1541 if ((sk->sk_shutdown == SHUTDOWN_MASK) ||
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 3d21414ba357..3763bedecf5f 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -716,7 +716,7 @@ static __poll_t tipc_poll(struct file *file, struct socket *sock,
716 struct tipc_sock *tsk = tipc_sk(sk); 716 struct tipc_sock *tsk = tipc_sk(sk);
717 __poll_t revents = 0; 717 __poll_t revents = 0;
718 718
719 sock_poll_wait(file, sk_sleep(sk), wait); 719 sock_poll_wait(file, wait);
720 720
721 if (sk->sk_shutdown & RCV_SHUTDOWN) 721 if (sk->sk_shutdown & RCV_SHUTDOWN)
722 revents |= EPOLLRDHUP | EPOLLIN | EPOLLRDNORM; 722 revents |= EPOLLRDHUP | EPOLLIN | EPOLLRDNORM;
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index e5473c03d667..1772a0e32665 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2635,7 +2635,7 @@ static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wa
2635 struct sock *sk = sock->sk; 2635 struct sock *sk = sock->sk;
2636 __poll_t mask; 2636 __poll_t mask;
2637 2637
2638 sock_poll_wait(file, sk_sleep(sk), wait); 2638 sock_poll_wait(file, wait);
2639 mask = 0; 2639 mask = 0;
2640 2640
2641 /* exceptional events? */ 2641 /* exceptional events? */
@@ -2672,7 +2672,7 @@ static __poll_t unix_dgram_poll(struct file *file, struct socket *sock,
2672 unsigned int writable; 2672 unsigned int writable;
2673 __poll_t mask; 2673 __poll_t mask;
2674 2674
2675 sock_poll_wait(file, sk_sleep(sk), wait); 2675 sock_poll_wait(file, wait);
2676 mask = 0; 2676 mask = 0;
2677 2677
2678 /* exceptional events? */ 2678 /* exceptional events? */