aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/dtc/util.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-10 11:57:03 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-10 11:57:03 -0500
commit0bd2cbcdfaff9cb22267d66fc843fa4f73f0c281 (patch)
tree7d9732bcf5f2f646cb0c2c529c48b454b15d4ae2 /scripts/dtc/util.h
parent57cc7215b70856dc6bae8e55b00ecd7b1d7429b1 (diff)
parenta081748735c5feb96b1365e78a5ff0fb6ca7e3a4 (diff)
Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6
* 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6: (29 commits) of/flattree: forward declare struct device_node in of_fdt.h ipmi: explicitly include of_address.h and of_irq.h sparc: explicitly cast negative phandle checks to s32 powerpc/405: Fix missing #{address,size}-cells in i2c node powerpc/5200: dts: refactor dts files powerpc/5200: dts: Change combatible strings on localbus powerpc/5200: dts: remove unused properties powerpc/5200: dts: rename nodes to prepare for refactoring dts files of/flattree: Update dtc to current mainline. of/device: Don't register disabled devices powerpc/dts: fix syntax bugs in bluestone.dts of: Fixes for OF probing on little endian systems of: make drivers depend on CONFIG_OF instead of CONFIG_PPC_OF of/flattree: Add of_flat_dt_match() helper function of_serial: explicitly include of_irq.h of/flattree: Refactor unflatten_device_tree and add fdt_unflatten_tree of/flattree: Reorder unflatten_dt_node of/flattree: Refactor unflatten_dt_node of/flattree: Add non-boottime device tree functions of/flattree: Add Kconfig for EARLY_FLATTREE ... Fix up trivial conflict in arch/sparc/prom/tree_32.c as per Grant.
Diffstat (limited to 'scripts/dtc/util.h')
-rw-r--r--scripts/dtc/util.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/scripts/dtc/util.h b/scripts/dtc/util.h
new file mode 100644
index 00000000000..9cead842c11
--- /dev/null
+++ b/scripts/dtc/util.h
@@ -0,0 +1,56 @@
1#ifndef _UTIL_H
2#define _UTIL_H
3
4/*
5 * Copyright 2008 Jon Loeliger, Freescale Semiconductor, Inc.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 */
22
23static inline void __attribute__((noreturn)) die(char * str, ...)
24{
25 va_list ap;
26
27 va_start(ap, str);
28 fprintf(stderr, "FATAL ERROR: ");
29 vfprintf(stderr, str, ap);
30 exit(1);
31}
32
33static inline void *xmalloc(size_t len)
34{
35 void *new = malloc(len);
36
37 if (!new)
38 die("malloc() failed\n");
39
40 return new;
41}
42
43static inline void *xrealloc(void *p, size_t len)
44{
45 void *new = realloc(p, len);
46
47 if (!new)
48 die("realloc() failed (len=%d)\n", len);
49
50 return new;
51}
52
53extern char *xstrdup(const char *s);
54extern char *join_path(const char *path, const char *name);
55
56#endif /* _UTIL_H */