[U-Boot] [PATCH v3 5/6] fdt: ARM: Add fdtcontroladdr to set device tree address in environment

Simon Glass sjg at chromium.org
Thu Oct 13 23:08:13 CEST 2011


Hi Mike,

On Thu, Oct 13, 2011 at 1:27 PM, Mike Frysinger <vapier at gentoo.org> wrote:
> On Tuesday 11 October 2011 18:26:10 Simon Glass wrote:
>> --- a/arch/arm/lib/board.c
>> +++ b/arch/arm/lib/board.c
>>
>> +/**
>> + * Decode the value of an environment variable and return it.
>> + *
>> + * @param name               Name of environemnt variable
>> + * @param base               Number base to use (normally 10, or 16 for hex)
>> + * @param default_val        Default value to return if the variable is not
>> + *                   found
>> + * @return the decoded value, or default_val if not found
>> + */
>> +static int getenv_int(const char *name, int base, int default_val)
>> +{
>> +     char tmp[64];   /* long enough for environment variables */
>> +     int i = getenv_f(name, tmp, sizeof(tmp));
>> +
>> +     return (i > 0)
>> +             ? (int) simple_strtoul(tmp, NULL, base)
>> +             : default_val;
>> +}
>
> pretty much everyone does this with gd->baudrate.  would make sense to put
> this into common/cmd_nvedit.c and convert all arches.
> -mike
>

I was worried someone might say that. I will take a look.

Regards,
Simon


More information about the U-Boot mailing list