[U-Boot] [PATCH V3 for NET] tsec: do not print Speed: if using netconsole

Wolfgang Denk wd at denx.de
Mon Feb 1 12:36:42 CET 2010


Dear Ed Swarthout,

In message <1265019802-32030-1-git-send-email-Ed.Swarthout at freescale.com> you wrote:
> CONFIG_NETCONSOLE on the p2020ds is functional with the tsec driver.  
> But the printf in adjust_link() which is called by startup_tsec()
> called by tsec_init() in tsec.c is making it impossible to use.
> 
> For example typing 12345 on the netconsole causes the message to be
> printed for every character:
> 
> => Speed: 1000, full duplex
> 1Speed: 1000, full duplex
> 2Speed: 1000, full duplex
> 3Speed: 1000, full duplex
> 4Speed: 1000, full duplex
> 5Speed: 1000, full duplex
> 
> Signed-off-by: Ed Swarthout <Ed.Swarthout at freescale.com>
> ---
>  drivers/net/tsec.c |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
> index fd49eff..392072f 100644
> --- a/drivers/net/tsec.c
> +++ b/drivers/net/tsec.c
> @@ -941,10 +941,12 @@ static void adjust_link(struct eth_device *dev)
>  			break;
>  		}
>  
> -		printf("Speed: %d, %s duplex%s\n", priv->speed,
> -		       (priv->duplexity) ? "full" : "half",
> -		       (priv->flags & TSEC_FIBER) ? ", fiber mode" : "");
> -
> +		if (strcmp(getenv("stdin"), "nc") != 0) {
> +			printf("Speed: %d, %s duplex%s\n", priv->speed,
> +				(priv->duplexity) ? "full" : "half",
> +				(priv->flags & TSEC_FIBER) ?
> +					", fiber mode" : "");
> +		}

I think this status of the console connection should be latched into
a variable (in tsec_init() ?) so we can avoid the (pretty expensive)
scanning of the environment for every transmitted character.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Peace was the way.
	-- Kirk, "The City on the Edge of Forever", stardate unknown


More information about the U-Boot mailing list