linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hvc_console: returning 0 from put_chars is not an error
@ 2009-10-14 21:53 Timur Tabi
  2009-10-15 11:05 ` Christian Borntraeger
  0 siblings, 1 reply; 13+ messages in thread
From: Timur Tabi @ 2009-10-14 21:53 UTC (permalink / raw)
  To: linuxppc-dev, scottwood, borntraeger, brueckner

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@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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-10-17 23:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-14 21:53 [PATCH] hvc_console: returning 0 from put_chars is not an error Timur Tabi
2009-10-15 11:05 ` Christian Borntraeger
2009-10-15 16:09   ` Scott Wood
2009-10-15 18:41     ` Christian Borntraeger
2009-10-15 18:55       ` Timur Tabi
2009-10-15 18:57       ` Scott Wood
2009-10-15 19:26         ` Christian Borntraeger
2009-10-15 19:32           ` Scott Wood
2009-10-16  8:49             ` Hendrik Brueckner
2009-10-17 23:17               ` Timur Tabi
2009-10-16  4:46         ` Benjamin Herrenschmidt
2009-10-16 15:33           ` Scott Wood
2009-10-16 18:03             ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).