RDMA/ucma: Simplify ucma_get_event()

Use wait_event_interruptible() instead of a more complicated
open-coded equivalent.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
This commit is contained in:
Sean Hefty 2007-04-05 10:49:51 -07:00 committed by Roland Dreier
parent 30c00986f3
commit d92f76448c
1 changed files with 9 additions and 17 deletions

View File

@ -306,25 +306,17 @@ static ssize_t ucma_get_event(struct ucma_file *file, const char __user *inbuf,
mutex_lock(&file->mut);
while (list_empty(&file->event_list)) {
if (file->filp->f_flags & O_NONBLOCK) {
ret = -EAGAIN;
break;
}
if (signal_pending(current)) {
ret = -ERESTARTSYS;
break;
}
prepare_to_wait(&file->poll_wait, &wait, TASK_INTERRUPTIBLE);
mutex_unlock(&file->mut);
schedule();
mutex_lock(&file->mut);
finish_wait(&file->poll_wait, &wait);
}
if (ret)
goto done;
if (file->filp->f_flags & O_NONBLOCK)
return -EAGAIN;
if (wait_event_interruptible(file->poll_wait,
!list_empty(&file->event_list)))
return -ERESTARTSYS;
mutex_lock(&file->mut);
}
uevent = list_entry(file->event_list.next, struct ucma_event, list);