projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
68b2fc7
)
tty: hvc: hvc_write() fix break condition
author
Nicholas Piggin
<
[email protected]
>
Sun, 9 Sep 2018 05:39:16 +0000
(15:39 +1000)
committer
Greg Kroah-Hartman
<
[email protected]
>
Mon, 10 Sep 2018 16:04:31 +0000
(18:04 +0200)
Commit
550ddadcc758
("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: Matteo Croce <
[email protected]
>
Tested-by: Jason Gunthorpe <
[email protected]
>
Tested-by: Leon Romanovsky <
[email protected]
>
Signed-off-by: Nicholas Piggin <
[email protected]
>
Signed-off-by: Greg Kroah-Hartman <
[email protected]
>
drivers/tty/hvc/hvc_console.c
patch
|
blob
|
history
diff --git
a/drivers/tty/hvc/hvc_console.c
b/drivers/tty/hvc/hvc_console.c
index bacf9b73ec984170de4f694e546100d81ed9f384..27284a2dcd2b62395c5b140900ccca85a68ab683 100644
(file)
--- a/
drivers/tty/hvc/hvc_console.c
+++ b/
drivers/tty/hvc/hvc_console.c
@@
-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);