提交 7f2bf784 编写于 作者: N Nicholas Piggin 提交者: Greg Kroah-Hartman

tty: hvc: hvc_write() fix break condition

Commit 550ddadc ("tty: hvc: hvc_write() may sleep") broke the
termination condition in case the driver stops accepting characters.
This can result in unnecessary polling of the busy driver.

Restore it by testing the hvc_push return code.
Tested-by: NMatteo Croce <mcroce@redhat.com>
Tested-by: NJason Gunthorpe <jgg@mellanox.com>
Tested-by: NLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 68b2fc71
......@@ -522,6 +522,8 @@ static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count
return -EIO;
while (count > 0) {
int ret = 0;
spin_lock_irqsave(&hp->lock, flags);
rsize = hp->outbuf_size - hp->n_outbuf;
......@@ -537,10 +539,13 @@ static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count
}
if (hp->n_outbuf > 0)
hvc_push(hp);
ret = hvc_push(hp);
spin_unlock_irqrestore(&hp->lock, flags);
if (!ret)
break;
if (count) {
if (hp->n_outbuf > 0)
hvc_flush(hp);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册