[U-Boot] [PATCH 3/6] stdio: dm: Make stdio_devices[] local

Marek Vasut marex at denx.de
Sat Sep 1 22:14:45 CEST 2012


Dear Marek Vasut,

> Use stdio_get_fd() and stdio_set_fd() instead of direct access
> to the array. This allows making stdio_devices[] local to stdio.c
> 
> Signed-off-by: Marek Vasut <marex at denx.de>
> Cc: Wolfgang Denk <wd at denx.de>

[...]

> @@ -622,6 +635,7 @@ int console_init_r(void)
>  {
>  	char *stdinname, *stdoutname, *stderrname;
>  	struct stdio_dev *inputdev = NULL, *outputdev = NULL, *errdev = NULL;
> +	struct stdio_dev *sio;

Self-review: NAK! This generates a warning.

Self-reply: V2 on the way.

>  #ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
>  	int i;
>  #endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
> @@ -690,7 +704,9 @@ done:
>  #ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
>  	/* set the environment variables (will overwrite previous env settings)
> */ for (i = 0; i < 3; i++) {
> -		setenv(stdio_names[i], stdio_devices[i]->name);
> +		sio = stdio_get_fd(i);
> +		if (sio)
> +			setenv(stdio_names[i], sio->name);
>  	}
>  #endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
> 

[...]

Best regards,


More information about the U-Boot mailing list