Deleted Added
full compact
fdt.c (238742) fdt.c (261215)
1/*
2 * libfdt - Flat Device Tree manipulation
3 * Copyright (C) 2006 David Gibson, IBM Corporation.
4 *
5 * libfdt is dual licensed: you can use it either under the terms of
6 * the GPL, or the BSD license, at your option.
7 *
8 * a) This library is free software; you can redistribute it and/or

--- 78 unchanged lines hidden (view full) ---

87
88 if (p + len < p)
89 return NULL;
90 return p;
91}
92
93uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset)
94{
1/*
2 * libfdt - Flat Device Tree manipulation
3 * Copyright (C) 2006 David Gibson, IBM Corporation.
4 *
5 * libfdt is dual licensed: you can use it either under the terms of
6 * the GPL, or the BSD license, at your option.
7 *
8 * a) This library is free software; you can redistribute it and/or

--- 78 unchanged lines hidden (view full) ---

87
88 if (p + len < p)
89 return NULL;
90 return p;
91}
92
93uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset)
94{
95 const uint32_t *tagp, *lenp;
95 const fdt32_t *tagp, *lenp;
96 uint32_t tag;
97 int offset = startoffset;
98 const char *p;
99
100 *nextoffset = -FDT_ERR_TRUNCATED;
101 tagp = fdt_offset_ptr(fdt, offset, FDT_TAGSIZE);
102 if (!tagp)
103 return FDT_END; /* premature end */

--- 89 unchanged lines hidden (view full) ---

193 else
194 return nextoffset;
195 }
196 } while (tag != FDT_BEGIN_NODE);
197
198 return offset;
199}
200
96 uint32_t tag;
97 int offset = startoffset;
98 const char *p;
99
100 *nextoffset = -FDT_ERR_TRUNCATED;
101 tagp = fdt_offset_ptr(fdt, offset, FDT_TAGSIZE);
102 if (!tagp)
103 return FDT_END; /* premature end */

--- 89 unchanged lines hidden (view full) ---

193 else
194 return nextoffset;
195 }
196 } while (tag != FDT_BEGIN_NODE);
197
198 return offset;
199}
200
201int fdt_first_subnode(const void *fdt, int offset)
202{
203 int depth = 0;
204
205 offset = fdt_next_node(fdt, offset, &depth);
206 if (offset < 0 || depth != 1)
207 return -FDT_ERR_NOTFOUND;
208
209 return offset;
210}
211
212int fdt_next_subnode(const void *fdt, int offset)
213{
214 int depth = 1;
215
216 /*
217 * With respect to the parent, the depth of the next subnode will be
218 * the same as the last.
219 */
220 do {
221 offset = fdt_next_node(fdt, offset, &depth);
222 if (offset < 0 || depth < 1)
223 return -FDT_ERR_NOTFOUND;
224 } while (depth > 1);
225
226 return offset;
227}
228
201const char *_fdt_find_string(const char *strtab, int tabsize, const char *s)
202{
203 int len = strlen(s) + 1;
204 const char *last = strtab + tabsize - len;
205 const char *p;
206
207 for (p = strtab; p <= last; p++)
208 if (memcmp(p, s, len) == 0)

--- 14 unchanged lines hidden ---
229const char *_fdt_find_string(const char *strtab, int tabsize, const char *s)
230{
231 int len = strlen(s) + 1;
232 const char *last = strtab + tabsize - len;
233 const char *p;
234
235 for (p = strtab; p <= last; p++)
236 if (memcmp(p, s, len) == 0)

--- 14 unchanged lines hidden ---