From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Date: Thu, 13 Oct 2011 16:33:23 -0400 Subject: [U-Boot] [PATCH v3 6/6] fdt: add decode helper library In-Reply-To: <1318371971-4457-7-git-send-email-sjg@chromium.org> References: <1318371971-4457-1-git-send-email-sjg@chromium.org> <1318371971-4457-7-git-send-email-sjg@chromium.org> Message-ID: <201110131633.25542.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:11 Simon Glass wrote: > --- /dev/null > +++ b/include/fdtdec.h > > +/* > + * A typedef for a physical address. Note that fdt data is always big > + * endian even on a litle endian machine. > + */ > +#ifdef CONFIG_PHYS_64BIT > +typedef u64 addr_t; > +#define ADDR_T_NONE (-1ULL) > +#define addr_to_cpu(reg) be64_to_cpu(reg) > +#else > +typedef u32 addr_t; > +#define ADDR_T_NONE (-1U) > +#define addr_to_cpu(reg) be32_to_cpu(reg) > +#endif "addr" is fairly generic. how about "fdt_addr" instead ? > --- /dev/null > +++ b/lib/fdtdec.c > > +/* we need a generic GPIO interface here */ > +#include we have asm/gpio.h now, although i don't see this code using anything from the gpio header to need this include ... > +static const char *compat_names[COMPAT_COUNT] = { static const char * const compat_names[COMPAT_COUNT] = { > +int fdtdec_next_alias(const void *blob, const char *name, > + enum fdt_compat_id id, int *upto) > +{ > +#define MAX_STR_LEN 20 > + char str[MAX_STR_LEN + 20]; > + int node, err; > + > + sprintf(str, "%.*s%d", MAX_STR_LEN, name, *upto); where's that "20" coming from ? just arbitrarily defined ? might want to add an assert(strlen(name) <= MAX_STR_LEN). -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/c6b28a7b/attachment.pgp