mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 21:02:43 +01:00
fs/timerfd.c: make use of wait_event_interruptible_locked_irq()
This patch modifies the fs/timerfd.c to use the newly created wait_event_interruptible_locked_irq() macro. This replaces an open code implementation with a single macro call. Signed-off-by: Michal Nazarewicz <[email protected]> Cc: Kyungmin Park <[email protected]> Cc: Marek Szyprowski <[email protected]> Cc: Alexander Viro <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Roland Dreier <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Davide Libenzi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
1 parent
22c43c81a5
commit
8120a8aadb
1 file changed
+4
-21
+4
-21
@@ -110,31 +110,14 @@ static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count,
|
||||
struct timerfd_ctx *ctx = file->private_data;
|
||||
ssize_t res;
|
||||
u64 ticks = 0;
|
||||
DECLARE_WAITQUEUE(wait, current);
|
||||
|
||||
if (count < sizeof(ticks))
|
||||
return -EINVAL;
|
||||
spin_lock_irq(&ctx->wqh.lock);
|
||||
res = -EAGAIN;
|
||||
if (!ctx->ticks && !(file->f_flags & O_NONBLOCK)) {
|
||||
__add_wait_queue(&ctx->wqh, &wait);
|
||||
for (res = 0;;) {
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
if (ctx->ticks) {
|
||||
res = 0;
|
||||
break;
|
||||
}
|
||||
if (signal_pending(current)) {
|
||||
res = -ERESTARTSYS;
|
||||
break;
|
||||
}
|
||||
spin_unlock_irq(&ctx->wqh.lock);
|
||||
schedule();
|
||||
spin_lock_irq(&ctx->wqh.lock);
|
||||
}
|
||||
__remove_wait_queue(&ctx->wqh, &wait);
|
||||
__set_current_state(TASK_RUNNING);
|
||||
}
|
||||
if (file->f_flags & O_NONBLOCK)
|
||||
res = -EAGAIN;
|
||||
else
|
||||
res = wait_event_interruptible_locked_irq(ctx->wqh, ctx->ticks);
|
||||
if (ctx->ticks) {
|
||||
ticks = ctx->ticks;
|
||||
if (ctx->expired && ctx->tintv.tv64) {
|
||||
|
||||
Reference in new issue
Block a user