[U-Boot] [PATCH 2/2] env_mmc: default to 0 if CONFIG_SYS_MMC_ENV_DEV not defined

Hector Palacios hector.palacios at digi.com
Thu Jan 16 19:13:03 CET 2014


Hi Stephen,

On 01/15/2014 06:40 PM, Stephen Warren wrote:
> On 01/15/2014 03:53 AM, Hector Palacios wrote:
>> Since function mmc_get_env_devno is __weak and can be overridden by
>> board code, boards do not necessarily need to define
>> CONFIG_SYS_MMC_ENV_DEV. If the constant is not defined, return 0 by
>> default.
>
> Ah, I see that's a better justification for allowing the define not to
> be set.
>
>
>> diff --git a/common/env_mmc.c b/common/env_mmc.c
>
>>   __weak int mmc_get_env_devno(void)
>>   {
>> +#ifdef CONFIG_SYS_MMC_ENV_DEV
>>   	return CONFIG_SYS_MMC_ENV_DEV;
>> +#endif
>
> Same comment here; need a #else here, and #endif below.
>> +	return 0;
>> +}
>
> Re: Hector's comments: Perhaps the following in
> include/config_fallbacks.h would be appropriate?
>
> #ifndef CONFIG_SYS_MMC_ENV_DEV
> #define CONFIG_SYS_MMC_ENV_DEV 0
> #endif

This define is only used in common/env_mmc.c so I think the default definition should 
stay on that file, rather than in include/config_fallbacks.h.

Best regards,
--
Hector Palacios


More information about the U-Boot mailing list