All of lore.kernel.org
 help / color / mirror / Atom feed
From: Atin Malaviya <atin.malaviya@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] usbtty: Added additional usbtty_configured() checks to get	around hang when usb is not connected but multi-io is set up.
Date: Tue, 3 Feb 2009 08:01:02 -0500	[thread overview]
Message-ID: <20090203130102.GA8008@thor> (raw)

This adds additional checks in usbtty_puts() and usbtty_putc() to get around a hang when usb is not
connected but multi-io (setenv stdout serial,usbtty etc) is set up by the user. We hang because the
buffers get full because usb isn't connected.
---
 drivers/serial/usbtty.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c
index 7eba470..0e4e17d 100644
--- a/drivers/serial/usbtty.c
+++ b/drivers/serial/usbtty.c
@@ -433,6 +433,9 @@ int usbtty_getc (void)
  */
 void usbtty_putc (const char c)
 {
+	if (!usbtty_configured ())
+		return;
+
 	buf_push (&usbtty_output, &c, 1);
 	/* If \n, also do \r */
 	if (c == '\n')
@@ -486,8 +489,12 @@ static void __usbtty_puts (const char *str, int len)
 void usbtty_puts (const char *str)
 {
 	int n;
-	int len = strlen (str);
+	int len;
+
+	if (!usbtty_configured ())
+		return;
 
+	len = strlen (str);
 	/* add '\r' for each '\n' */
 	while (len > 0) {
 		n = next_nl_pos (str);
-- 
1.5.6.3

                 reply	other threads:[~2009-02-03 13:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090203130102.GA8008@thor \
    --to=atin.malaviya@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.