]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.0.1/hvc_console-improve-tty-console-put_chars-handling.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.0.1 / hvc_console-improve-tty-console-put_chars-handling.patch
CommitLineData
d53dcc05
GKH
1From 8c2381af0d3ef62a681dac5a141b6dabb27bf2e1 Mon Sep 17 00:00:00 2001
2From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
3Date: Tue, 5 Jul 2011 21:50:18 +0000
4Subject: hvc_console: Improve tty/console put_chars handling
5
6From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
7
8commit 8c2381af0d3ef62a681dac5a141b6dabb27bf2e1 upstream.
9
10Currently, the hvc_console_print() function drops console output if the
11hvc backend's put_chars() returns 0. This patch changes this behavior
12to allow a retry through returning -EAGAIN.
13
14This change also affects the hvc_push() function. Both functions are
15changed to handle -EAGAIN and to retry the put_chars() operation.
16
17If a hvc backend returns -EAGAIN, the retry handling differs:
18
19 - hvc_console_print() spins to write the complete console output.
20 - hvc_push() behaves the same way as for returning 0.
21
22Now hvc backends can indirectly control the way how console output is
23handled through the hvc console layer.
24
25Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
26Acked-by: Anton Blanchard <anton@samba.org>
27Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
28Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
29
30---
31 drivers/tty/hvc/hvc_console.c | 8 +++++---
32 1 file changed, 5 insertions(+), 3 deletions(-)
33
34--- a/drivers/tty/hvc/hvc_console.c
35+++ b/drivers/tty/hvc/hvc_console.c
36@@ -163,8 +163,10 @@ static void hvc_console_print(struct con
37 } else {
38 r = cons_ops[index]->put_chars(vtermnos[index], c, i);
39 if (r <= 0) {
40- /* throw away chars on error */
41- i = 0;
42+ /* throw away characters on error
43+ * but spin in case of -EAGAIN */
44+ if (r != -EAGAIN)
45+ i = 0;
46 } else if (r > 0) {
47 i -= r;
48 if (i > 0)
49@@ -448,7 +450,7 @@ static int hvc_push(struct hvc_struct *h
50
51 n = hp->ops->put_chars(hp->vtermno, hp->outbuf, hp->n_outbuf);
52 if (n <= 0) {
53- if (n == 0) {
54+ if (n == 0 || n == -EAGAIN) {
55 hp->do_wakeup = 1;
56 return 0;
57 }