IB/ucm: Simplify ib_ucm_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:51:05 -07:00 коммит произвёл Roland Dreier
Родитель d92f76448c
Коммит 9d41b7fdea
1 изменённых файлов: 8 добавлений и 19 удалений

Просмотреть файл

@ -407,29 +407,18 @@ static ssize_t ib_ucm_event(struct ib_ucm_file *file,
mutex_lock(&file->file_mutex);
while (list_empty(&file->events)) {
if (file->filp->f_flags & O_NONBLOCK) {
result = -EAGAIN;
break;
}
if (signal_pending(current)) {
result = -ERESTARTSYS;
break;
}
prepare_to_wait(&file->poll_wait, &wait, TASK_INTERRUPTIBLE);
mutex_unlock(&file->file_mutex);
schedule();
if (file->filp->f_flags & O_NONBLOCK)
return -EAGAIN;
if (wait_event_interruptible(file->poll_wait,
!list_empty(&file->events)))
return -ERESTARTSYS;
mutex_lock(&file->file_mutex);
finish_wait(&file->poll_wait, &wait);
}
if (result)
goto done;
uevent = list_entry(file->events.next, struct ib_ucm_event, file_list);
if (ib_ucm_new_cm_id(uevent->resp.event)) {