Backlogged trivial dtc patches
cover Backlogged trivial dtc patches
Here are a couple of trivial patches for dtc I still have in my stack from way back but haven't made it into git yet.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/2 libfdt: Fix error in documentation for fdt_get_alias_namelen()
Oops, screwed up the function name in the documenting comment for this function. Trivial correction in this patch.
libfdt/libfdt.h +1 -1
@@ -459,7 +459,7 @@ static inline void *fdt_getprop_w(void *uint32_t fdt_get_phandle (const void *fdt,int nodeoffset);/** -* fdt_get_namelen - get alias based on substring +* fdt_get_alias_namelen - get alias based on substring * @fdt: pointer to the device tree blob * @name: name of the alias th look up * @namelen: number of characters of name to consider
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/2 dtc: Move some functions to util.[ch]
Now that we have a util.[ch] file shared between dtc and convert-dtsv0, move some functions which are currently duplicated in the two to util files. Specifically we move the die(), xmalloc() and xrealloc() functions.
While we're at it, add standard double-include protection to util.h
convert-dtsv0-lexer.l +0 -20
@@ -52,26 +52,6 @@ static char *last_name; /* = NULL */ #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -static inline void __attribute__((noreturn)) die(char * str, ...) -{ - va_list ap; - - va_start(ap, str); - fprintf(stderr, "FATAL ERROR: "); - vfprintf(stderr, str, ap); - exit(1); -} - -static inline void *xmalloc(size_t len) -{ - void *new = malloc(len); - - if (! new) - die("malloc() failed\n"); - - return new; -} - const struct { const char *pattern; int obase, width;
dtc.h +0 -30
@@ -53,36 +53,6 @@ extern int reservenum; /* Number of memextern int minsize;/* Minimum blob size */ extern int padsize;/* Additional padding to blob */ -static inline void __attribute__((noreturn))die (char * str, ...) -{ -va_list ap; - -va_start (ap, str); -fprintf (stderr,"FATAL ERROR: " ); -vfprintf (stderr, str, ap); -exit (1 ); -} - -static inline void *xmalloc (size_t len) -{ -void *new =malloc (len); - -if (! new) -die ("malloc() failed\n" ); - -return new; -} - -static inline void *xrealloc (void *p,size_t len) -{ -void *new =realloc (p, len); - -if (! new) -die ("realloc() failed (len=%d)\n" , len); - -return new; -} -typedef uint32_t cell_t ;
util.h +35 -0
@@ -1,3 +1,6 @@ +#ifndef _UTIL_H +#define _UTIL_H +/* * Copyright 2008 Jon Loeliger, Freescale Semiconductor, Inc. *
@@ -17,4 +20,36 @@* USA */ +static inline void __attribute__((noreturn))die (char * str, ...) +{ +va_list ap; + +va_start (ap, str); +fprintf (stderr,"FATAL ERROR: " ); +vfprintf (stderr, str, ap); +exit (1 ); +} + +static inline void *xmalloc (size_t len) +{ +void *new =malloc (len); + +if (!new) +die ("malloc() failed\n" ); + +return new; +} + +static inline void *xrealloc (void *p,size_t len) +{ +void *new =realloc (p, len); + +if (!new) +die ("realloc() failed (len=%d)\n" , len); + +return new; +} +extern char *xstrdup (const char *s); + +#endif /* _UTIL_H */
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [2/2] dtc: Move some functions to util.[ch]
Quoted 8 lines
Now that we have a util.[ch] file shared between dtc and convert-dtsv0, move some functions which are currently duplicated in the two to util files. Specifically we move the
die(),xmalloc()andxrealloc()functions.While we're at it, add standard double-include protection to
util.hSigned-off-by David Gibson <[email protected]>
I would have sworn I applied this one earlier...
But now it definitely has been.
Thanks,
jdl
Jon Loeliger
AppliedRe: [1/2] libfdt: Fix error in documentation for fdt_get_alias_namelen()
In reply to a message not in the archiveQuoted 4 lines
Oops, screwed up the function name in the documenting comment for this function. Trivial correction in this patch.
Signed-off-by David Gibson <[email protected]>
Applied.
Thanks,
jdl