[U-Boot] [PATCH v3 5/6] fdt: ARM: Add fdtcontroladdr to set device tree address in environment
Mike Frysinger
vapier at gentoo.org
Thu Oct 13 22:27:04 CEST 2011
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111013/6b35acb2/attachment.pgp
More information about the U-Boot
mailing list