aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>2011-07-05 17:50:18 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-07-19 01:13:05 -0400
commit8c2381af0d3ef62a681dac5a141b6dabb27bf2e1 (patch)
tree42cd8aaecca37a7fce9d81d20fcd78f9d86647b1 /drivers/tty
parent63f21a56f1cc0b800a4c00349c59448f82473d19 (diff)
hvc_console: Improve tty/console put_chars handling
Currently, the hvc_console_print() function drops console output if the hvc backend's put_chars() returns 0. This patch changes this behavior to allow a retry through returning -EAGAIN. This change also affects the hvc_push() function. Both functions are changed to handle -EAGAIN and to retry the put_chars() operation. If a hvc backend returns -EAGAIN, the retry handling differs: - hvc_console_print() spins to write the complete console output. - hvc_push() behaves the same way as for returning 0. Now hvc backends can indirectly control the way how console output is handled through the hvc console layer. Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Acked-by: Anton Blanchard <anton@samba.org> Cc: <stable@kernel.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/hvc/hvc_console.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
index f8ff6f50fc35..59000750cc73 100644
--- a/drivers/tty/hvc/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
@@ -163,8 +163,10 @@ static void hvc_console_print(struct console *co, const char *b,
163 } else { 163 } else {
164 r = cons_ops[index]->put_chars(vtermnos[index], c, i); 164 r = cons_ops[index]->put_chars(vtermnos[index], c, i);
165 if (r <= 0) { 165 if (r <= 0) {
166 /* throw away chars on error */ 166 /* throw away characters on error
167 i = 0; 167 * but spin in case of -EAGAIN */
168 if (r != -EAGAIN)
169 i = 0;
168 } else if (r > 0) { 170 } else if (r > 0) {
169 i -= r; 171 i -= r;
170 if (i > 0) 172 if (i > 0)
@@ -448,7 +450,7 @@ static int hvc_push(struct hvc_struct *hp)
448 450
449 n = hp->ops->put_chars(hp->vtermno, hp->outbuf, hp->n_outbuf); 451 n = hp->ops->put_chars(hp->vtermno, hp->outbuf, hp->n_outbuf);
450 if (n <= 0) { 452 if (n <= 0) {
451 if (n == 0) { 453 if (n == 0 || n == -EAGAIN) {
452 hp->do_wakeup = 1; 454 hp->do_wakeup = 1;
453 return 0; 455 return 0;
454 } 456 }