public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Allen Martin <amartin@nvidia.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/6] serial: Reorder serial_assign()
Date: Fri, 19 Oct 2012 17:45:54 -0700	[thread overview]
Message-ID: <20121020004554.GA25104@badger> (raw)
In-Reply-To: <1349568426-27219-4-git-send-email-marex@denx.de>

On Sat, Oct 06, 2012 at 05:07:03PM -0700, Marek Vasut wrote:
> Reorder serial_assign() function to get rid of the extra level of
> indentation. Also, adjust the return value to be -EINVAL instead of
> positive one to be more consistent.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> ---
>  drivers/serial/serial.c |   11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
> index da41cd5..1054494 100644
> --- a/drivers/serial/serial.c
> +++ b/drivers/serial/serial.c
> @@ -26,6 +26,7 @@
>  #include <stdio_dev.h>
>  #include <post.h>
>  #include <linux/compiler.h>
> +#include <errno.h>
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> @@ -203,13 +204,13 @@ int serial_assign(const char *name)
>  	struct serial_device *s;
>  
>  	for (s = serial_devices; s; s = s->next) {
> -		if (strcmp(s->name, name) == 0) {
> -			serial_current = s;
> -			return 0;
> -		}
> +		if (strcmp(s->name, name))
> +			continue;
> +		serial_current = s;
> +		return 0;
>  	}
>  
> -	return 1;
> +	return -EINVAL;

Hi Marek, the change to return value here broke serial output on
tegra.  What I see is that the serial device name (s->name) is
"eserial0" as set by serial_ns16550.c, and the name passed in from the
stdout environment is "serial" so they don't match and it fails.  This
always used to be ok because the return code didn't indicate failure
and iomux_doenv() would continue on happily, but now it causes
iomux_doenv() to fail and no printfs() work after that.

Not sure what the right fix is, should stdout really be set to
"eserial0"?  It seems "serial" should mean "the default serial device"
which for the normal case is the one and only device.

-Allen
-- 
nvpublic

  reply	other threads:[~2012-10-20  0:45 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-07  0:07 [U-Boot] [PATCH 0/6] Serial cleanup series Marek Vasut
2012-10-07  0:07 ` [U-Boot] [PATCH 1/6] serial: Implement default_serial_puts() Marek Vasut
2012-10-17 14:59   ` [U-Boot] [U-Boot,1/6] " Tom Rini
2012-10-07  0:07 ` [U-Boot] [PATCH 2/6] serial: Use default_serial_puts() in drivers Marek Vasut
2012-10-07  0:07 ` [U-Boot] [PATCH 3/6] serial: Reorder serial_assign() Marek Vasut
2012-10-20  0:45   ` Allen Martin [this message]
2012-10-20  8:19     ` Marek Vasut
2012-10-22 17:23       ` Allen Martin
2012-10-25 18:09         ` Simon Glass
2012-10-25 19:03           ` Marek Vasut
2012-10-25 20:48             ` Allen Martin
2012-10-25 21:02             ` Simon Glass
2012-10-25 21:19               ` Allen Martin
2012-10-25 21:27                 ` Tom Rini
2012-10-25 21:31                   ` Allen Martin
2012-10-25 22:43                 ` Joe Hershberger
2012-10-26 10:22                   ` Marek Vasut
2012-10-26 17:34                     ` Allen Martin
2012-10-26 18:39                     ` Joe Hershberger
2012-10-26 21:55                       ` Allen Martin
2012-10-27 12:39                         ` Marek Vasut
2012-10-07  0:07 ` [U-Boot] [PATCH 4/6] serial: Reorder get_current() Marek Vasut
2012-10-07  0:07 ` [U-Boot] [PATCH 5/6] kerneldoc: Annotate drivers/serial/serial.c Marek Vasut
2012-10-08 19:37   ` Tom Rini
2012-10-08 22:56     ` Tom Rini
2012-10-08 23:26       ` Marek Vasut
2012-10-08 20:58   ` [U-Boot] [PATCH 5/6 V2] " Marek Vasut
2012-10-08 21:36     ` [U-Boot] [PATCH 5/6 V3] " Marek Vasut
2012-10-07  0:07 ` [U-Boot] [PATCH 6/6] kerneldoc: stdio: tmpl: Add stdio template Marek Vasut

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=20121020004554.GA25104@badger \
    --to=amartin@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox