[PATCH] hvc_console: returning 0 from put_chars is not an error
Timur Tabi
timur at freescale.com
Thu Oct 15 08:53:46 EST 2009
hvc_console_print() calls the HVC client driver's put_chars() callback
to write some characters to the console. If the callback returns 0, that
indicates that no characters were written (perhaps the output buffer is
full), but hvc_console_print() treats that as an error and discards the
rest of the buffer.
So change hvc_console_print() to just loop and call put_chars() again if it
returns a 0 return code.
This change makes hvc_console_print() behave more like hvc_push(), which does
check for a 0 return code and re-schedules itself.
Signed-off-by: Timur Tabi <timur at freescale.com>
---
This patch might cause a hang in drivers that return 0 in case of error,
instead of a negative number, but those drivers are broken anyway. This
patch might fix drivers that return 0 to indicate that they're busy, such as
arch/powerpc/platforms/pseries/hvconsole.c. It will break drivers that
return 0 if their output buffer is full, but where those buffers cannot be
emptied while the kernel is in a loop.
drivers/char/hvc_console.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index 25ce15b..0c94907 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -161,7 +161,7 @@ static void hvc_console_print(struct console *co, const char *b,
}
} else {
r = cons_ops[index]->put_chars(vtermnos[index], c, i);
- if (r <= 0) {
+ if (r < 0) {
/* throw away chars on error */
i = 0;
} else if (r > 0) {
--
1.6.5
More information about the Linuxppc-dev
mailing list