Skip to content

Commit a331de3

Browse files
Christoph Hellwigdavem330
authored andcommitted
net: remove sock_poll_busy_flag
Fold it into the only caller to make the code simpler and easier to read. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f641f13 commit a331de3

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎include/net/busy_poll.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,6 @@ static inline void sk_busy_loop(struct sock *sk, int nonblock)
121121
#endif
122122
}
123123

124-
/* if this socket can poll_ll, tell the system call */
125-
static inline __poll_t sock_poll_busy_flag(struct socket *sock)
126-
{
127-
return sk_can_busy_loop(sock->sk) ? POLL_BUSY_LOOP : 0;
128-
}
129-
130124
/* used in the NIC receive handler to mark the skb */
131125
static inline void skb_mark_napi_id(struct sk_buff *skb,
132126
struct napi_struct *napi)

‎net/socket.c‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,15 +1130,21 @@ EXPORT_SYMBOL(sock_create_lite);
11301130
static __poll_t sock_poll(struct file *file, poll_table *wait)
11311131
{
11321132
struct socket *sock = file->private_data;
1133-
__poll_t events = poll_requested_events(wait);
1133+
__poll_t events = poll_requested_events(wait), flag = 0;
11341134

11351135
if (!sock->ops->poll)
11361136
return 0;
11371137

1138-
/* poll once if requested by the syscall */
1139-
if (sk_can_busy_loop(sock->sk) && (events & POLL_BUSY_LOOP))
1140-
sk_busy_loop(sock->sk, 1);
1141-
return sock->ops->poll(file, sock, wait) | sock_poll_busy_flag(sock);
1138+
if (sk_can_busy_loop(sock->sk)) {
1139+
/* poll once if requested by the syscall */
1140+
if (events & POLL_BUSY_LOOP)
1141+
sk_busy_loop(sock->sk, 1);
1142+
1143+
/* if this socket can poll_ll, tell the system call */
1144+
flag = POLL_BUSY_LOOP;
1145+
}
1146+
1147+
return sock->ops->poll(file, sock, wait) | flag;
11421148
}
11431149

11441150
static int sock_mmap(struct file *file, struct vm_area_struct *vma)

0 commit comments

Comments
 (0)