From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Date: Thu, 13 Oct 2011 16:27:04 -0400 Subject: [U-Boot] [PATCH v3 5/6] fdt: ARM: Add fdtcontroladdr to set device tree address in environment In-Reply-To: <1318371971-4457-6-git-send-email-sjg@chromium.org> References: <1318371971-4457-1-git-send-email-sjg@chromium.org> <1318371971-4457-6-git-send-email-sjg@chromium.org> Message-ID: <201110131627.07213.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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