[U-Boot] [PATCH v0 4/7] x86: Provide more configuration granularity

Wolfgang Denk wd at denx.de
Mon Nov 7 22:55:54 CET 2011


Dear Graeme Russ,

In message <1320459711-20257-5-git-send-email-graeme.russ at gmail.com> you wrote:
> Planned future ports requires more granularity for some options
...
> +#if defined(CONFIG_CMD_NET)
>  	char *s;
> +#endif
> +#ifndef CONFIG_SYS_NO_FLASH
>  	ulong size;
> +#endif
...
> +#ifndef CONFIG_SYS_NO_FLASH
>  	/* configure available FLASH banks */
>  	size = flash_init();
>  	display_flash_config(size);
>  	show_boot_progress(0x24);
> +#endif

The more often I see this, the less I like it.  In a number of recent
cleanup patches I tried to avoid such multiple #ifdefs by using local
blocks, like that:


#ifndef CONFIG_SYS_NO_FLASH
	{
		ulong size;

		/* configure available FLASH banks */
		size = flash_init();
		display_flash_config(size);
		show_boot_progress(0x24);
	}
#endif

This is not exactly nice either, but at least keeps the related
declarations and code together, and reduces the number of #ifdef's.

Have a look at it and feel free to use this method if you like it,
or just ignore it.

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
They say a little knowledge is a dangerous thing,  but it is not  one
half so bad as a lot of ignorance.   - Terry Pratchett, _Equal Rites_


More information about the U-Boot mailing list