aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/dtc/libfdt/fdt_wip.c
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-09-28 17:25:59 -0400
committerRob Herring <rob.herring@calxeda.com>2012-10-01 12:11:35 -0400
commitcd296721a9645f9f28800a072490fa15458d1fb7 (patch)
tree492b9a268a48af07844fbbd39519f95676ee73fe /scripts/dtc/libfdt/fdt_wip.c
parentacc2097934b5403b97f95763fe99fc115b818061 (diff)
dtc: import latest upstream dtc
This updates scripts/dtc to commit 317a5d9 "dtc: zero out new label objects" from git://git.jdl.com/software/dtc.git. This adds features such as: * /bits/ syntax for cell data. * Math expressions within cell data. * The ability to delete properties or nodes. * Support for #line directives in the input file, which allows the use of cpp on *.dts. * -i command-line option (/include/ path) * -W/-E command-line options for error/warning control. * Removal of spew to STDOUT containing the filename being compiled. * Many additions to the libfdt API. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Jon Loeliger <jdl@jdl.com> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'scripts/dtc/libfdt/fdt_wip.c')
-rw-r--r--scripts/dtc/libfdt/fdt_wip.c41
1 files changed, 7 insertions, 34 deletions
diff --git a/scripts/dtc/libfdt/fdt_wip.c b/scripts/dtc/libfdt/fdt_wip.c
index a4652c6e787e..6025fa1fe8fe 100644
--- a/scripts/dtc/libfdt/fdt_wip.c
+++ b/scripts/dtc/libfdt/fdt_wip.c
@@ -94,41 +94,14 @@ int fdt_nop_property(void *fdt, int nodeoffset, const char *name)
94 return 0; 94 return 0;
95} 95}
96 96
97int _fdt_node_end_offset(void *fdt, int nodeoffset) 97int _fdt_node_end_offset(void *fdt, int offset)
98{ 98{
99 int level = 0; 99 int depth = 0;
100 uint32_t tag; 100
101 int offset, nextoffset; 101 while ((offset >= 0) && (depth >= 0))
102 102 offset = fdt_next_node(fdt, offset, &depth);
103 tag = fdt_next_tag(fdt, nodeoffset, &nextoffset); 103
104 if (tag != FDT_BEGIN_NODE) 104 return offset;
105 return -FDT_ERR_BADOFFSET;
106 do {
107 offset = nextoffset;
108 tag = fdt_next_tag(fdt, offset, &nextoffset);
109
110 switch (tag) {
111 case FDT_END:
112 return offset;
113
114 case FDT_BEGIN_NODE:
115 level++;
116 break;
117
118 case FDT_END_NODE:
119 level--;
120 break;
121
122 case FDT_PROP:
123 case FDT_NOP:
124 break;
125
126 default:
127 return -FDT_ERR_BADSTRUCTURE;
128 }
129 } while (level >= 0);
130
131 return nextoffset;
132} 105}
133 106
134int fdt_nop_node(void *fdt, int nodeoffset) 107int fdt_nop_node(void *fdt, int nodeoffset)