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 <m.nazarewicz@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Roland Dreier <rolandd@cisco.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Davide Libenzi <davidel@xmailserver.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Michal Nazarewicz 2010-05-05 12:53:12 +02:00 committed by Greg Kroah-Hartman
parent 22c43c81a5
commit 8120a8aadb

View File

@ -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; struct timerfd_ctx *ctx = file->private_data;
ssize_t res; ssize_t res;
u64 ticks = 0; u64 ticks = 0;
DECLARE_WAITQUEUE(wait, current);
if (count < sizeof(ticks)) if (count < sizeof(ticks))
return -EINVAL; return -EINVAL;
spin_lock_irq(&ctx->wqh.lock); spin_lock_irq(&ctx->wqh.lock);
res = -EAGAIN; if (file->f_flags & O_NONBLOCK)
if (!ctx->ticks && !(file->f_flags & O_NONBLOCK)) { res = -EAGAIN;
__add_wait_queue(&ctx->wqh, &wait); else
for (res = 0;;) { res = wait_event_interruptible_locked_irq(ctx->wqh, ctx->ticks);
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 (ctx->ticks) { if (ctx->ticks) {
ticks = ctx->ticks; ticks = ctx->ticks;
if (ctx->expired && ctx->tintv.tv64) { if (ctx->expired && ctx->tintv.tv64) {