Char: n_r3964, use wait_event_interruptible

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Jiri Slaby 2007-07-15 23:40:20 -07:00 коммит произвёл Linus Torvalds
Родитель e0955e14f7
Коммит 6defec139a
1 изменённых файлов: 2 добавлений и 12 удалений

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

@ -1071,8 +1071,6 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
struct r3964_client_info *pClient;
struct r3964_message *pMsg;
struct r3964_client_message theMsg;
DECLARE_WAITQUEUE(wait, current);
int count;
TRACE_L("read()");
@ -1086,16 +1084,8 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
return -EAGAIN;
}
/* block until there is a message: */
add_wait_queue(&pInfo->read_wait, &wait);
repeat:
__set_current_state(TASK_INTERRUPTIBLE);
pMsg = remove_msg(pInfo, pClient);
if (!pMsg && !signal_pending(current)) {
schedule();
goto repeat;
}
__set_current_state(TASK_RUNNING);
remove_wait_queue(&pInfo->read_wait, &wait);
wait_event_interruptible(pInfo->read_wait,
(pMsg = remove_msg(pInfo, pClient)));
}
/* If we still haven't got a message, we must have been signalled */