[U-Boot] [PATCH] lcd: Add support for CONFIG_LCD_NOSTDOUT

Gerhard Sittig gsi at denx.de
Thu Mar 6 20:49:05 CET 2014


On Thu, Mar 06, 2014 at 15:26 +0100, Hannes Petermaier wrote:
> 
> --- a/common/lcd.c
> +++ b/common/lcd.c
> @@ -400,12 +400,12 @@ __weak int lcd_get_size(int *line_length)
>  
>  int drv_lcd_init(void)
>  {
> -	struct stdio_dev lcddev;
> -	int rc;
> -
>  	lcd_base = (void *) gd->fb_base;
>  
>  	lcd_init(lcd_base);		/* LCD initialization */
> +#ifndef CONFIG_LCD_NOSTDOUT
> +	struct stdio_dev lcddev;
> +	int rc;
>  
>  	/* Device initialization */
>  	memset(&lcddev, 0, sizeof(lcddev));

What do language lawyers say about declarations after
instructions within blocks?  This looks somewhat fishy.

> @@ -419,6 +419,9 @@ int drv_lcd_init(void)
>  	rc = stdio_register(&lcddev);
>  
>  	return (rc == 0) ? 1 : rc;
> +#else
> +	return 0;
> +#endif
>  }

This (continuation from the above #ifndef) somehow reads like
inverted logic.  It appears like "ifdef NOSTDOUT" is a shortcut,
not a strict alternative as the patch suggests.

In general U-Boot tries to get away from the multitude of ifdefs
where possible.  I'm afraid adding a new one needs a very good
reason to get perceived as welcome.


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de


More information about the U-Boot mailing list