vfs: do bulk POLL* -> EPOLL* replacement

This is the mindless scripted replacement of kernel use of POLL*
variables as described by Al, done by this script:

    for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
        L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
        for f in $L; do sed -i "-es/^\([^\"]*\)\(\<POLL$V\>\)/\\1E\\2/" $f; done
    done

with de-mangling cleanups yet to come.

NOTE! On almost all architectures, the EPOLL* constants have the same
values as the POLL* constants do.  But they keyword here is "almost".
For various bad reasons they aren't the same, and epoll() doesn't
actually work quite correctly in some cases due to this on Sparc et al.

The next patch from Al will sort out the final differences, and we
should be all done.

Scripted-by: Al Viro <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Linus Torvalds 2018-02-11 14:34:03 -08:00
commit a9a08845e9
297 changed files with 913 additions and 913 deletions

View file

@ -378,11 +378,11 @@ __poll_t afu_poll(struct file *file, struct poll_table_struct *poll)
spin_lock_irqsave(&ctx->lock, flags);
if (ctx_event_pending(ctx))
mask |= POLLIN | POLLRDNORM;
mask |= EPOLLIN | EPOLLRDNORM;
else if (ctx->status == CLOSED)
/* Only error on closed when there are no futher events pending
*/
mask |= POLLERR;
mask |= EPOLLERR;
spin_unlock_irqrestore(&ctx->lock, flags);
pr_devel("afu_poll pe: %i returning %#x\n", ctx->pe, mask);

View file

@ -519,9 +519,9 @@ static __poll_t ilo_poll(struct file *fp, poll_table *wait)
poll_wait(fp, &data->ccb_waitq, wait);
if (is_channel_reset(driver_ccb))
return POLLERR;
return EPOLLERR;
else if (ilo_pkt_recv(data->ilo_hw, driver_ccb))
return POLLIN | POLLRDNORM;
return EPOLLIN | EPOLLRDNORM;
return 0;
}

View file

@ -658,7 +658,7 @@ static __poll_t lis3lv02d_misc_poll(struct file *file, poll_table *wait)
poll_wait(file, &lis3->misc_wait, wait);
if (atomic_read(&lis3->count))
return POLLIN | POLLRDNORM;
return EPOLLIN | EPOLLRDNORM;
return 0;
}

View file

@ -551,31 +551,31 @@ static __poll_t mei_poll(struct file *file, poll_table *wait)
bool notify_en;
if (WARN_ON(!cl || !cl->dev))
return POLLERR;
return EPOLLERR;
dev = cl->dev;
mutex_lock(&dev->device_lock);
notify_en = cl->notify_en && (req_events & POLLPRI);
notify_en = cl->notify_en && (req_events & EPOLLPRI);
if (dev->dev_state != MEI_DEV_ENABLED ||
!mei_cl_is_connected(cl)) {
mask = POLLERR;
mask = EPOLLERR;
goto out;
}
if (notify_en) {
poll_wait(file, &cl->ev_wait, wait);
if (cl->notify_ev)
mask |= POLLPRI;
mask |= EPOLLPRI;
}
if (req_events & (POLLIN | POLLRDNORM)) {
if (req_events & (EPOLLIN | EPOLLRDNORM)) {
poll_wait(file, &cl->rx_wait, wait);
if (!list_empty(&cl->rd_completed))
mask |= POLLIN | POLLRDNORM;
mask |= EPOLLIN | EPOLLRDNORM;
else
mei_cl_read_start(cl, mei_cl_mtu(cl), file);
}

View file

@ -55,7 +55,7 @@
* message being sent to host SCIF. SCIF_DISCNCT message processing on the
* host SCIF sets the host COSM SCIF endpoint state to DISCONNECTED and wakes
* up the host COSM thread blocked in scif_poll(..) resulting in
* scif_poll(..) returning POLLHUP.
* scif_poll(..) returning EPOLLHUP.
* 5. On the card, scif_peer_release_dev is next called which results in an
* SCIF_EXIT message being sent to the host and after receiving the
* SCIF_EXIT_ACK from the host the peer device teardown on the card is
@ -79,7 +79,7 @@
* processing. This results in the COSM endpoint on the card being closed and
* the SCIF host peer device on the card getting unregistered similar to
* steps 3, 4 and 5 for the card shutdown case above. scif_poll(..) on the
* host returns POLLHUP as a result.
* host returns EPOLLHUP as a result.
* 4. On the host, card peer device unregister and SCIF HW remove(..) also
* subsequently complete.
*
@ -87,11 +87,11 @@
* ----------
* If a reset is issued after the card has crashed, there is no SCIF_DISCNT
* message from the card which would result in scif_poll(..) returning
* POLLHUP. In this case when the host SCIF driver sends a SCIF_REMOVE_NODE
* EPOLLHUP. In this case when the host SCIF driver sends a SCIF_REMOVE_NODE
* message to itself resulting in the card SCIF peer device being unregistered,
* this results in a scif_peer_release_dev -> scif_cleanup_scifdev->
* scif_invalidate_ep call sequence which sets the endpoint state to
* DISCONNECTED and results in scif_poll(..) returning POLLHUP.
* DISCONNECTED and results in scif_poll(..) returning EPOLLHUP.
*/
#define COSM_SCIF_BACKLOG 16
@ -190,7 +190,7 @@ static void cosm_send_time(struct cosm_device *cdev)
/*
* Close this cosm_device's endpoint after its peer endpoint on the card has
* been closed. In all cases except MIC card crash POLLHUP on the host is
* been closed. In all cases except MIC card crash EPOLLHUP on the host is
* triggered by the client's endpoint being closed.
*/
static void cosm_scif_close(struct cosm_device *cdev)
@ -252,7 +252,7 @@ void cosm_scif_work(struct work_struct *work)
while (1) {
pollepd.epd = cdev->epd;
pollepd.events = POLLIN;
pollepd.events = EPOLLIN;
/* Drop the mutex before blocking in scif_poll(..) */
mutex_unlock(&cdev->cosm_mutex);
@ -266,11 +266,11 @@ void cosm_scif_work(struct work_struct *work)
}
/* There is a message from the card */
if (pollepd.revents & POLLIN)
if (pollepd.revents & EPOLLIN)
cosm_scif_recv(cdev);
/* The peer endpoint is closed or this endpoint disconnected */
if (pollepd.revents & POLLHUP) {
if (pollepd.revents & EPOLLHUP) {
cosm_scif_close(cdev);
break;
}

View file

@ -160,7 +160,7 @@ static int cosm_scif_client(void *unused)
while (!kthread_should_stop()) {
pollepd.epd = client_epd;
pollepd.events = POLLIN;
pollepd.events = EPOLLIN;
rc = scif_poll(&pollepd, 1, COSM_HEARTBEAT_SEND_MSEC);
if (rc < 0) {
@ -171,7 +171,7 @@ static int cosm_scif_client(void *unused)
continue;
}
if (pollepd.revents & POLLIN)
if (pollepd.revents & EPOLLIN)
cosm_client_recv();
msg.id = COSM_MSG_HEARTBEAT;

View file

@ -1328,7 +1328,7 @@ __scif_pollfd(struct file *f, poll_table *wait, struct scif_endpt *ep)
if (ep->state == SCIFEP_CONNECTED ||
ep->state == SCIFEP_DISCONNECTED ||
ep->conn_err)
mask |= POLLOUT;
mask |= EPOLLOUT;
goto exit;
}
}
@ -1338,34 +1338,34 @@ __scif_pollfd(struct file *f, poll_table *wait, struct scif_endpt *ep)
_scif_poll_wait(f, &ep->conwq, wait, ep);
if (ep->state == SCIFEP_LISTENING) {
if (ep->conreqcnt)
mask |= POLLIN;
mask |= EPOLLIN;
goto exit;
}
}
/* Endpoint is connected or disconnected */
if (ep->state == SCIFEP_CONNECTED || ep->state == SCIFEP_DISCONNECTED) {
if (poll_requested_events(wait) & POLLIN)
if (poll_requested_events(wait) & EPOLLIN)
_scif_poll_wait(f, &ep->recvwq, wait, ep);
if (poll_requested_events(wait) & POLLOUT)
if (poll_requested_events(wait) & EPOLLOUT)
_scif_poll_wait(f, &ep->sendwq, wait, ep);
if (ep->state == SCIFEP_CONNECTED ||
ep->state == SCIFEP_DISCONNECTED) {
/* Data can be read without blocking */
if (scif_rb_count(&ep->qp_info.qp->inbound_q, 1))
mask |= POLLIN;
mask |= EPOLLIN;
/* Data can be written without blocking */
if (scif_rb_space(&ep->qp_info.qp->outbound_q))
mask |= POLLOUT;
/* Return POLLHUP if endpoint is disconnected */
mask |= EPOLLOUT;
/* Return EPOLLHUP if endpoint is disconnected */
if (ep->state == SCIFEP_DISCONNECTED)
mask |= POLLHUP;
mask |= EPOLLHUP;
goto exit;
}
}
/* Return POLLERR if the endpoint is in none of the above states */
mask |= POLLERR;
/* Return EPOLLERR if the endpoint is in none of the above states */
mask |= EPOLLERR;
exit:
spin_unlock(&ep->lock);
return mask;
@ -1398,10 +1398,10 @@ scif_poll(struct scif_pollepd *ufds, unsigned int nfds, long timeout_msecs)
pt = &table.pt;
while (1) {
for (i = 0; i < nfds; i++) {
pt->_key = ufds[i].events | POLLERR | POLLHUP;
pt->_key = ufds[i].events | EPOLLERR | EPOLLHUP;
mask = __scif_pollfd(ufds[i].epd->anon,
pt, ufds[i].epd);
mask &= ufds[i].events | POLLERR | POLLHUP;
mask &= ufds[i].events | EPOLLERR | EPOLLHUP;
if (mask) {
count++;
pt->_qproc = NULL;

View file

@ -1010,7 +1010,7 @@ __unlock_ret:
}
/*
* We return POLLIN | POLLOUT from poll when new buffers are enqueued, and
* We return EPOLLIN | EPOLLOUT from poll when new buffers are enqueued, and
* not when previously enqueued buffers may be available. This means that
* in the card->host (TX) path, when userspace is unblocked by poll it
* must drain all available descriptors or it can stall.
@ -1022,15 +1022,15 @@ static __poll_t vop_poll(struct file *f, poll_table *wait)
mutex_lock(&vdev->vdev_mutex);
if (vop_vdev_inited(vdev)) {
mask = POLLERR;
mask = EPOLLERR;
goto done;
}
poll_wait(f, &vdev->waitq, wait);
if (vop_vdev_inited(vdev)) {
mask = POLLERR;
mask = EPOLLERR;
} else if (vdev->poll_wake) {
vdev->poll_wake = 0;
mask = POLLIN | POLLOUT;
mask = EPOLLIN | EPOLLOUT;
}
done:
mutex_unlock(&vdev->vdev_mutex);

View file

@ -215,9 +215,9 @@ static unsigned int afu_poll(struct file *file, struct poll_table_struct *wait)
mutex_unlock(&ctx->status_mutex);
if (afu_events_pending(ctx))
mask = POLLIN | POLLRDNORM;
mask = EPOLLIN | EPOLLRDNORM;
else if (closed)
mask = POLLERR;
mask = EPOLLERR;
return mask;
}

View file

@ -265,9 +265,9 @@ static __poll_t phantom_poll(struct file *file, poll_table *wait)
poll_wait(file, &dev->wait, wait);
if (!(dev->status & PHB_RUNNING))
mask = POLLERR;
mask = EPOLLERR;
else if (atomic_read(&dev->counter))
mask = POLLIN | POLLRDNORM;
mask = EPOLLIN | EPOLLRDNORM;
pr_debug("phantom_poll end: %x/%d\n", mask, atomic_read(&dev->counter));

View file

@ -182,7 +182,7 @@ static __poll_t vmci_host_poll(struct file *filp, poll_table *wait)
if (context->pending_datagrams > 0 ||
vmci_handle_arr_get_size(
context->pending_doorbell_array) > 0) {
mask = POLLIN;
mask = EPOLLIN;
}
spin_unlock(&context->lock);
}