diff options
author | Christoph Hellwig <hch@lst.de> | 2018-03-05 07:23:51 -0800 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-26 09:16:44 +0200 |
commit | 652fe8e87621d95a94edd25a08d5754abd878161 (patch) | |
tree | 8c0850cfe6b8cec1c5d644c19f10b2c4af93e438 /fs/timerfd.c | |
parent | 9e42f195f5b5cae4cf8ec71432c0fdaf641d1b73 (diff) | |
download | lwn-652fe8e87621d95a94edd25a08d5754abd878161.tar.gz lwn-652fe8e87621d95a94edd25a08d5754abd878161.zip |
timerfd: convert to ->poll_mask
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/timerfd.c')
-rw-r--r-- | fs/timerfd.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/timerfd.c b/fs/timerfd.c index cdad49da3ff7..d84a2bee4f82 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c @@ -226,21 +226,20 @@ static int timerfd_release(struct inode *inode, struct file *file) kfree_rcu(ctx, rcu); return 0; } - -static __poll_t timerfd_poll(struct file *file, poll_table *wait) + +static struct wait_queue_head *timerfd_get_poll_head(struct file *file, + __poll_t eventmask) { struct timerfd_ctx *ctx = file->private_data; - __poll_t events = 0; - unsigned long flags; - poll_wait(file, &ctx->wqh, wait); + return &ctx->wqh; +} - spin_lock_irqsave(&ctx->wqh.lock, flags); - if (ctx->ticks) - events |= EPOLLIN; - spin_unlock_irqrestore(&ctx->wqh.lock, flags); +static __poll_t timerfd_poll_mask(struct file *file, __poll_t eventmask) +{ + struct timerfd_ctx *ctx = file->private_data; - return events; + return ctx->ticks ? EPOLLIN : 0; } static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count, @@ -364,7 +363,8 @@ static long timerfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg static const struct file_operations timerfd_fops = { .release = timerfd_release, - .poll = timerfd_poll, + .get_poll_head = timerfd_get_poll_head, + .poll_mask = timerfd_poll_mask, .read = timerfd_read, .llseek = noop_llseek, .show_fdinfo = timerfd_show, |