]>
Commit | Line | Data |
---|---|---|
d53dcc05 GKH |
1 | From 8c2381af0d3ef62a681dac5a141b6dabb27bf2e1 Mon Sep 17 00:00:00 2001 |
2 | From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> | |
3 | Date: Tue, 5 Jul 2011 21:50:18 +0000 | |
4 | Subject: hvc_console: Improve tty/console put_chars handling | |
5 | ||
6 | From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> | |
7 | ||
8 | commit 8c2381af0d3ef62a681dac5a141b6dabb27bf2e1 upstream. | |
9 | ||
10 | Currently, the hvc_console_print() function drops console output if the | |
11 | hvc backend's put_chars() returns 0. This patch changes this behavior | |
12 | to allow a retry through returning -EAGAIN. | |
13 | ||
14 | This change also affects the hvc_push() function. Both functions are | |
15 | changed to handle -EAGAIN and to retry the put_chars() operation. | |
16 | ||
17 | If 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 | ||
22 | Now hvc backends can indirectly control the way how console output is | |
23 | handled through the hvc console layer. | |
24 | ||
25 | Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> | |
26 | Acked-by: Anton Blanchard <anton@samba.org> | |
27 | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> | |
28 | Signed-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 | } |