* [0/2] Backlogged trivial dtc patches
@ 2009-01-05 1:44 David Gibson
[not found] ` <20090105014436.GC11210-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: David Gibson @ 2009-01-05 1:44 UTC (permalink / raw)
To: Jon Loeliger; +Cc: devicetree-discuss-mnsaURCQ41sdnm+yROfE0A
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.
--
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
^ permalink raw reply [flat|nested] 5+ messages in thread[parent not found: <20090105014436.GC11210-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>]
* [1/2] libfdt: Fix error in documentation for fdt_get_alias_namelen() [not found] ` <20090105014436.GC11210-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org> @ 2009-01-05 1:47 ` David Gibson [not found] ` <20090105014745.GE11210-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: David Gibson @ 2009-01-05 1:47 UTC (permalink / raw) To: Jon Loeliger; +Cc: devicetree-discuss-mnsaURCQ41sdnm+yROfE0A Oops, screwed up the function name in the documenting comment for this function. Trivial correction in this patch. Signed-off-by: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> Index: dtc/libfdt/libfdt.h =================================================================== --- dtc.orig/libfdt/libfdt.h 2008-10-04 14:46:50.000000000 +1000 +++ dtc/libfdt/libfdt.h 2008-10-04 14:46:56.000000000 +1000 @@ -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 -- 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20090105014745.GE11210-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>]
* [2/2] dtc: Move some functions to util.[ch] [not found] ` <20090105014745.GE11210-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org> @ 2009-01-05 1:50 ` David Gibson [not found] ` <20090105015023.GF11210-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org> 2009-01-07 15:52 ` [1/2] libfdt: Fix error in documentation for fdt_get_alias_namelen() Jon Loeliger 1 sibling, 1 reply; 5+ messages in thread From: David Gibson @ 2009-01-05 1:50 UTC (permalink / raw) To: Jon Loeliger; +Cc: devicetree-discuss-mnsaURCQ41sdnm+yROfE0A 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 Signed-off-by: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> Index: dtc/convert-dtsv0-lexer.l =================================================================== --- dtc.orig/convert-dtsv0-lexer.l 2008-10-04 15:20:44.000000000 +1000 +++ dtc/convert-dtsv0-lexer.l 2008-10-04 22:22:23.000000000 +1000 @@ -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; Index: dtc/dtc.h =================================================================== --- dtc.orig/dtc.h 2008-10-04 15:19:46.000000000 +1000 +++ dtc/dtc.h 2008-10-04 22:22:23.000000000 +1000 @@ -53,36 +53,6 @@ extern int reservenum; /* Number of mem extern 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; Index: dtc/util.h =================================================================== --- dtc.orig/util.h 2008-10-04 15:20:03.000000000 +1000 +++ dtc/util.h 2008-10-04 22:22:23.000000000 +1000 @@ -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 */ -- 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20090105015023.GF11210-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>]
* Re: [2/2] dtc: Move some functions to util.[ch] [not found] ` <20090105015023.GF11210-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org> @ 2009-01-07 15:53 ` Jon Loeliger 0 siblings, 0 replies; 5+ messages in thread From: Jon Loeliger @ 2009-01-07 15:53 UTC (permalink / raw) To: David Gibson; +Cc: devicetree-discuss-mnsaURCQ41sdnm+yROfE0A > 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 > > Signed-off-by: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> I would have sworn I applied this one earlier... But now it definitely has been. Thanks, jdl ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [1/2] libfdt: Fix error in documentation for fdt_get_alias_namelen() [not found] ` <20090105014745.GE11210-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org> 2009-01-05 1:50 ` [2/2] dtc: Move some functions to util.[ch] David Gibson @ 2009-01-07 15:52 ` Jon Loeliger 1 sibling, 0 replies; 5+ messages in thread From: Jon Loeliger @ 2009-01-07 15:52 UTC (permalink / raw) To: David Gibson; +Cc: devicetree-discuss-mnsaURCQ41sdnm+yROfE0A > Oops, screwed up the function name in the documenting comment for this > function. Trivial correction in this patch. > > Signed-off-by: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> Applied. Thanks, jdl ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-01-07 15:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-05 1:44 [0/2] Backlogged trivial dtc patches David Gibson
[not found] ` <20090105014436.GC11210-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
2009-01-05 1:47 ` [1/2] libfdt: Fix error in documentation for fdt_get_alias_namelen() David Gibson
[not found] ` <20090105014745.GE11210-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
2009-01-05 1:50 ` [2/2] dtc: Move some functions to util.[ch] David Gibson
[not found] ` <20090105015023.GF11210-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
2009-01-07 15:53 ` Jon Loeliger
2009-01-07 15:52 ` [1/2] libfdt: Fix error in documentation for fdt_get_alias_namelen() Jon Loeliger
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.