Skip to contentSkip to conversation

__poll_t regressions this cycle

PATCH In review Al Viro 2 participants 3 messages Jun 18, 2018 – Jun 20, 2018

Subsystems (12)
Networking DRM drivers VFS SCSI +8 more subsystems
lore
Share & tools
lore

Al Viro

author maintainer
#0 lore raw

PATCH 1/1 __poll_t regressions this cycle

	Some misannotations cropped up in this cycle's merges;

the fixes are trivial. Do you prefer it in one commit, or split into per-driver pieces?

---

drivers/android/binder.c +1 -1
index 95283f3bb51c..7fbb86215809 100644
@@ -4412,7 +4412,7 @@ static __poll_t binder_poll(struct file *filp,
 
 	thread = binder_get_thread(proc);
 	if (!thread)
-		return POLLERR;
+		return EPOLLERR;
 
 	binder_inner_proc_lock(thread->proc);
 	thread->looper |= BINDER_LOOPER_STATE_POLL;
drivers/char/random.c +2 -2
index a8fb0020ba5c..a7b9be0c7c7e 100644
@@ -722,7 +722,7 @@ static void credit_entropy_bits(struct entropy_store *r, int nbits)
 		/* should we wake readers? */
 		if (entropy_bits >= random_read_wakeup_bits &&
 		    wq_has_sleeper(&random_wait)) {
-			wake_up_interruptible_poll(&random_wait, POLLIN);
+			wake_up_interruptible_poll(&random_wait, EPOLLIN);
 			kill_fasync(&fasync, SIGIO, POLL_IN);
 		}
 		/* If the input pool is getting full, send some
@@ -1396,7 +1396,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,
 	trace_debit_entropy(r->name, 8 * ibytes);
 	if (ibytes &&
 	    (r->entropy_count >> ENTROPY_SHIFT) < random_write_wakeup_bits) {
-		wake_up_interruptible_poll(&random_wait, POLLOUT);
+		wake_up_interruptible_poll(&random_wait, EPOLLOUT);
 		kill_fasync(&fasync, SIGIO, POLL_OUT);
 	}
 
drivers/gpu/drm/drm_debugfs_crc.c +3 -3
index 9f8312137cad..7763c55f355d 100644
@@ -307,17 +307,17 @@ static ssize_t crtc_crc_read(struct file *filep, char __user *user_buf,
 	return LINE_LEN(crc->values_cnt);
 }
 
-static unsigned int crtc_crc_poll(struct file *file, poll_table *wait)
+static __poll_t crtc_crc_poll(struct file *file, poll_table *wait)
 {
 	struct drm_crtc *crtc = file->f_inode->i_private;
 	struct drm_crtc_crc *crc = &crtc->crc;
-	unsigned ret;
+	__poll_t ret;
 
 	poll_wait(file, &crc->wq, wait);
 
 	spin_lock_irq(&crc->lock);
 	if (crc->source && crtc_crc_data_count(crc))
-		ret = POLLIN | POLLRDNORM;
+		ret = EPOLLIN | EPOLLRDNORM;
 	else
 		ret = 0;
 	spin_unlock_irq(&crc->lock);
drivers/misc/ibmvmc.c +3 -3
index fb83d1375638..5efef9f6e76d 100644
@@ -999,11 +999,11 @@ static ssize_t ibmvmc_read(struct file *file, char *buf, size_t nbytes,
  * Return:
  *	poll.h return values
  */
-static unsigned int ibmvmc_poll(struct file *file, poll_table *wait)
+static __poll_t ibmvmc_poll(struct file *file, poll_table *wait)
 {
 	struct ibmvmc_file_session *session;
 	struct ibmvmc_hmc *hmc;
-	unsigned int mask = 0;
+	__poll_t mask = 0;
 
 	session = file->private_data;
 	if (!session)
@@ -1016,7 +1016,7 @@ static unsigned int ibmvmc_poll(struct file *file, poll_table *wait)
 	poll_wait(file, &ibmvmc_read_wait, wait);
 
 	if (hmc->queue_head != hmc->queue_tail)
-		mask |= POLLIN | POLLRDNORM;
+		mask |= EPOLLIN | EPOLLRDNORM;
 
 	return mask;
 }
drivers/misc/mei/main.c +2 -2
index 7465f17e1559..826e7e1fc34f 100644
@@ -600,10 +600,10 @@ static __poll_t mei_poll(struct file *file, poll_table *wait)
 			mei_cl_read_start(cl, mei_cl_mtu(cl), file);
 	}
 
-	if (req_events & (POLLOUT | POLLWRNORM)) {
+	if (req_events & (EPOLLOUT | EPOLLWRNORM)) {
 		poll_wait(file, &cl->tx_wait, wait);
 		if (cl->tx_cb_queued < dev->tx_queue_limit)
-			mask |= POLLOUT | POLLWRNORM;
+			mask |= EPOLLOUT | EPOLLWRNORM;
 	}
 
 out:
drivers/scsi/cxlflash/ocxl_hw.c +4 -4
index 0a95b5f25380..1b6198e5a565 100644
@@ -1015,20 +1015,20 @@ static inline bool ctx_event_pending(struct ocxlflash_context *ctx)
  *
  * Return: poll mask
  */
-static unsigned int afu_poll(struct file *file, struct poll_table_struct *poll)
+static __poll_t afu_poll(struct file *file, struct poll_table_struct *poll)
 {
 	struct ocxlflash_context *ctx = file->private_data;
 	struct device *dev = ctx->hw_afu->dev;
 	ulong lock_flags;
-	int mask = 0;
+	__poll_t mask = 0;
 
 	poll_wait(file, &ctx->wq, poll);
 
 	spin_lock_irqsave(&ctx->slock, lock_flags);
 	if (ctx_event_pending(ctx))
-		mask |= POLLIN | POLLRDNORM;
+		mask |= EPOLLIN | EPOLLRDNORM;
 	else if (ctx->state == CLOSED)
-		mask |= POLLERR;
+		mask |= EPOLLERR;
 	spin_unlock_irqrestore(&ctx->slock, lock_flags);
 
 	dev_dbg(dev, "%s: Poll wait completed for pe %i mask %i\n",
fs/select.c +1 -1
index 317891ff8165..1335288ed67a 100644
@@ -39,7 +39,7 @@ __poll_t vfs_poll(struct file *file, struct poll_table_struct *pt)
 	if (file->f_op->poll) {
 		return file->f_op->poll(file, pt);
 	} else if (file_has_poll_mask(file)) {
-		unsigned int events = poll_requested_events(pt);
+		__poll_t events = poll_requested_events(pt);
 		struct wait_queue_head *head;
 
 		if (pt && pt->_qproc) {
net/rds/af_rds.c +1 -1
index ab751a150f70..1c5f9693af4c 100644
@@ -185,7 +185,7 @@ static __poll_t rds_poll(struct file *file, struct socket *sock,
 	if (rs->rs_snd_bytes < rds_sk_sndbuf(rs))
 		mask |= (EPOLLOUT | EPOLLWRNORM);
 	if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue))
-		mask |= POLLERR;
+		mask |= EPOLLERR;
 	read_unlock_irqrestore(&rs->rs_recv_lock, flags);
 
 	/* clear state any time we wake a seen-congested socket */
net/xdp/xsk.c +2 -2
index 36919a254ba3..82d321b8e61b 100644
@@ -307,9 +307,9 @@ static __poll_t xsk_poll_mask(struct socket *sock, __poll_t events)
 	struct xdp_sock *xs = xdp_sk(sk);
 
 	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;
 }
#1 lore raw
Quoted 2 lines · Al Viro

Do you prefer it in one commit, or split into per-driver pieces?

If it's all the exact same issue with the same commit message, then just one commit.

Linus

author maintainer
#2 lore raw
Quoted 6 lines · Linus Torvalds
Quoted 2 lines · Al Viro

Do you prefer it in one commit, or split into per-driver pieces?

If it's all the exact same issue with the same commit message, then just one commit.

Some EPOLL... misspelled as POLL..., some ->poll() instances declared as returning unsigned int instead of __poll_t and some __poll_t local variables declared unsigned int. The only case beyond misannotations is POLLWRNORM instead of EPOLLWRNORM - basically, on sparc, mips et.al. EPOLLWRNORM (via epoll(7)) doesn't trigger for mei and xsk. Which used to be the case for all drivers (only EPOLLOUT used to trigger on these architectures) before the fixes this February...