Lines Matching +full:child +full:- +full:node

1 // SPDX-License-Identifier: GPL-2.0-or-later
19 if (streq(new->label, label)) { in add_label()
20 new->deleted = 0; in add_label()
26 new->label = label; in add_label()
27 new->next = *labels; in add_label()
36 label->deleted = 1; in delete_labels()
46 new->name = xstrdup(name); in build_property()
47 new->val = val; in build_property()
48 new->srcpos = srcpos_copy(srcpos); in build_property()
59 new->name = xstrdup(name); in build_property_delete()
60 new->deleted = 1; in build_property_delete()
67 assert(first->next == NULL); in chain_property()
69 first->next = list; in chain_property()
80 next = p->next; in reverse_properties()
81 p->next = head; in reverse_properties()
88 struct node *build_node(struct property *proplist, struct node *children, in build_node()
91 struct node *new = xmalloc(sizeof(*new)); in build_node()
92 struct node *child; in build_node() local
96 new->proplist = reverse_properties(proplist); in build_node()
97 new->children = children; in build_node()
98 new->srcpos = srcpos_copy(srcpos); in build_node()
100 for_each_child(new, child) { in build_node()
101 child->parent = new; in build_node()
107 struct node *build_node_delete(struct srcpos *srcpos) in build_node_delete()
109 struct node *new = xmalloc(sizeof(*new)); in build_node_delete()
113 new->deleted = 1; in build_node_delete()
114 new->srcpos = srcpos_copy(srcpos); in build_node_delete()
119 struct node *name_node(struct node *node, const char *name) in name_node() argument
121 assert(node->name == NULL); in name_node()
123 node->name = xstrdup(name); in name_node()
125 return node; in name_node()
128 struct node *omit_node_if_unused(struct node *node) in omit_node_if_unused() argument
130 node->omit_if_unused = 1; in omit_node_if_unused()
132 return node; in omit_node_if_unused()
135 struct node *reference_node(struct node *node) in reference_node() argument
137 node->is_referenced = 1; in reference_node()
139 return node; in reference_node()
142 struct node *merge_nodes(struct node *old_node, struct node *new_node) in merge_nodes()
145 struct node *new_child, *old_child; in merge_nodes()
148 old_node->deleted = 0; in merge_nodes()
150 /* Add new node labels to old node */ in merge_nodes()
151 for_each_label_withdel(new_node->labels, l) in merge_nodes()
152 add_label(&old_node->labels, l->label); in merge_nodes()
154 /* Move properties from the new node to the old node. If there in merge_nodes()
156 while (new_node->proplist) { in merge_nodes()
158 new_prop = new_node->proplist; in merge_nodes()
159 new_node->proplist = new_prop->next; in merge_nodes()
160 new_prop->next = NULL; in merge_nodes()
162 if (new_prop->deleted) { in merge_nodes()
163 delete_property_by_name(old_node, new_prop->name); in merge_nodes()
170 if (streq(old_prop->name, new_prop->name)) { in merge_nodes()
172 for_each_label_withdel(new_prop->labels, l) in merge_nodes()
173 add_label(&old_prop->labels, l->label); in merge_nodes()
175 old_prop->val = new_prop->val; in merge_nodes()
176 old_prop->deleted = 0; in merge_nodes()
177 srcpos_free(old_prop->srcpos); in merge_nodes()
178 old_prop->srcpos = new_prop->srcpos; in merge_nodes()
185 /* if no collision occurred, add property to the old node. */ in merge_nodes()
190 /* Move the override child nodes into the primary node. If in merge_nodes()
192 while (new_node->children) { in merge_nodes()
193 /* Pop the child node off the list */ in merge_nodes()
194 new_child = new_node->children; in merge_nodes()
195 new_node->children = new_child->next_sibling; in merge_nodes()
196 new_child->parent = NULL; in merge_nodes()
197 new_child->next_sibling = NULL; in merge_nodes()
199 if (new_child->deleted) { in merge_nodes()
200 delete_node_by_name(old_node, new_child->name); in merge_nodes()
207 if (streq(old_child->name, new_child->name)) { in merge_nodes()
214 /* if no collision occurred, add child to the old node. */ in merge_nodes()
219 old_node->srcpos = srcpos_extend(old_node->srcpos, new_node->srcpos); in merge_nodes()
221 /* The new node contents are now merged into the old node. Free in merge_nodes()
222 * the new node. */ in merge_nodes()
228 struct node * add_orphan_node(struct node *dt, struct node *new_node, char *ref) in add_orphan_node()
231 struct node *node; in add_orphan_node() local
240 p = build_property("target-path", d, NULL); in add_orphan_node()
251 node = build_node(p, new_node, NULL); in add_orphan_node()
252 name_node(node, name); in add_orphan_node()
255 add_child(dt, node); in add_orphan_node()
259 struct node *chain_node(struct node *first, struct node *list) in chain_node()
261 assert(first->next_sibling == NULL); in chain_node()
263 first->next_sibling = list; in chain_node()
267 void add_property(struct node *node, struct property *prop) in add_property() argument
271 prop->next = NULL; in add_property()
273 p = &node->proplist; in add_property()
275 p = &((*p)->next); in add_property()
280 void delete_property_by_name(struct node *node, char *name) in delete_property_by_name() argument
282 struct property *prop = node->proplist; in delete_property_by_name()
285 if (streq(prop->name, name)) { in delete_property_by_name()
289 prop = prop->next; in delete_property_by_name()
295 prop->deleted = 1; in delete_property()
296 delete_labels(&prop->labels); in delete_property()
299 void add_child(struct node *parent, struct node *child) in add_child() argument
301 struct node **p; in add_child()
303 child->next_sibling = NULL; in add_child()
304 child->parent = parent; in add_child()
306 p = &parent->children; in add_child()
308 p = &((*p)->next_sibling); in add_child()
310 *p = child; in add_child()
313 void delete_node_by_name(struct node *parent, char *name) in delete_node_by_name()
315 struct node *node = parent->children; in delete_node_by_name() local
317 while (node) { in delete_node_by_name()
318 if (streq(node->name, name)) { in delete_node_by_name()
319 delete_node(node); in delete_node_by_name()
322 node = node->next_sibling; in delete_node_by_name()
326 void delete_node(struct node *node) in delete_node() argument
329 struct node *child; in delete_node() local
331 node->deleted = 1; in delete_node()
332 for_each_child(node, child) in delete_node()
333 delete_node(child); in delete_node()
334 for_each_property(node, prop) in delete_node()
336 delete_labels(&node->labels); in delete_node()
339 void append_to_property(struct node *node, in append_to_property() argument
345 p = get_property(node, name); in append_to_property()
348 add_property(node, p); in append_to_property()
351 p->val = data_add_marker(p->val, type, name); in append_to_property()
352 p->val = data_append_data(p->val, data, len); in append_to_property()
355 static int append_unique_str_to_property(struct node *node, in append_unique_str_to_property() argument
360 p = get_property(node, name); in append_unique_str_to_property()
364 if (p->val.len && p->val.val[p->val.len - 1] != '\0') in append_unique_str_to_property()
366 return -1; in append_unique_str_to_property()
368 for (s = p->val.val; s < p->val.val + p->val.len; s = strchr(s, '\0') + 1) { in append_unique_str_to_property()
370 /* data already contained in node.name */ in append_unique_str_to_property()
375 add_property(node, p); in append_unique_str_to_property()
378 p->val = data_add_marker(p->val, TYPE_STRING, name); in append_unique_str_to_property()
379 p->val = data_append_data(p->val, data, len); in append_unique_str_to_property()
384 static int append_unique_u32_to_property(struct node *node, char *name, fdt32_t value) in append_unique_u32_to_property() argument
388 p = get_property(node, name); in append_unique_u32_to_property()
390 const fdt32_t *v, *val_end = (const fdt32_t *)p->val.val + p->val.len / 4; in append_unique_u32_to_property()
392 if (p->val.len % 4 != 0) in append_unique_u32_to_property()
394 return -1; in append_unique_u32_to_property()
396 for (v = (const void *)p->val.val; v < val_end; v++) { in append_unique_u32_to_property()
403 add_property(node, p); in append_unique_u32_to_property()
406 p->val = data_add_marker(p->val, TYPE_UINT32, name); in append_unique_u32_to_property()
407 p->val = data_append_data(p->val, &value, 4); in append_unique_u32_to_property()
418 new->address = address; in build_reserve_entry()
419 new->size = size; in build_reserve_entry()
427 assert(first->next == NULL); in chain_reserve_entry()
429 first->next = list; in chain_reserve_entry()
438 new->next = NULL; in add_reserve_entry()
443 for (last = list; last->next; last = last->next) in add_reserve_entry()
446 last->next = new; in add_reserve_entry()
453 struct node *tree, uint32_t boot_cpuid_phys) in build_dt_info()
458 dti->dtsflags = dtsflags; in build_dt_info()
459 dti->reservelist = reservelist; in build_dt_info()
460 dti->dt = tree; in build_dt_info()
461 dti->boot_cpuid_phys = boot_cpuid_phys; in build_dt_info()
470 const char *get_unitname(struct node *node) in get_unitname() argument
472 if (node->name[node->basenamelen] == '\0') in get_unitname()
475 return node->name + node->basenamelen + 1; in get_unitname()
478 struct property *get_property(struct node *node, const char *propname) in get_property() argument
482 for_each_property(node, prop) in get_property()
483 if (streq(prop->name, propname)) in get_property()
491 assert(prop->val.len == sizeof(cell_t)); in propval_cell()
492 return fdt32_to_cpu(*((fdt32_t *)prop->val.val)); in propval_cell()
497 assert(prop->val.len / sizeof(cell_t) > n); in propval_cell_n()
498 return fdt32_to_cpu(*((fdt32_t *)prop->val.val + n)); in propval_cell_n()
501 struct property *get_property_by_label(struct node *tree, const char *label, in get_property_by_label()
502 struct node **node) in get_property_by_label() argument
505 struct node *c; in get_property_by_label()
507 *node = tree; in get_property_by_label()
512 for_each_label(prop->labels, l) in get_property_by_label()
513 if (streq(l->label, label)) in get_property_by_label()
518 prop = get_property_by_label(c, label, node); in get_property_by_label()
523 *node = NULL; in get_property_by_label()
527 struct marker *get_marker_label(struct node *tree, const char *label, in get_marker_label()
528 struct node **node, struct property **prop) in get_marker_label() argument
532 struct node *c; in get_marker_label()
534 *node = tree; in get_marker_label()
538 m = p->val.markers; in get_marker_label()
540 if (streq(m->ref, label)) in get_marker_label()
545 m = get_marker_label(c, label, node, prop); in get_marker_label()
551 *node = NULL; in get_marker_label()
555 struct node *get_subnode(struct node *node, const char *nodename) in get_subnode() argument
557 struct node *child; in get_subnode() local
559 for_each_child(node, child) in get_subnode()
560 if (streq(child->name, nodename) && !child->deleted) in get_subnode()
561 return child; in get_subnode()
566 struct node *get_node_by_path(struct node *tree, const char *path) in get_node_by_path()
569 struct node *child; in get_node_by_path() local
572 if (tree->deleted) in get_node_by_path()
582 for_each_child(tree, child) { in get_node_by_path()
583 if (p && strprefixeq(path, (size_t)(p - path), child->name)) in get_node_by_path()
584 return get_node_by_path(child, p+1); in get_node_by_path()
585 else if (!p && streq(path, child->name)) in get_node_by_path()
586 return child; in get_node_by_path()
592 struct node *get_node_by_label(struct node *tree, const char *label) in get_node_by_label()
594 struct node *child, *node; in get_node_by_label() local
599 for_each_label(tree->labels, l) in get_node_by_label()
600 if (streq(l->label, label)) in get_node_by_label()
603 for_each_child(tree, child) { in get_node_by_label()
604 node = get_node_by_label(child, label); in get_node_by_label()
605 if (node) in get_node_by_label()
606 return node; in get_node_by_label()
612 struct node *get_node_by_phandle(struct node *tree, cell_t phandle) in get_node_by_phandle()
614 struct node *child, *node; in get_node_by_phandle() local
621 if (tree->phandle == phandle) { in get_node_by_phandle()
622 if (tree->deleted) in get_node_by_phandle()
627 for_each_child(tree, child) { in get_node_by_phandle()
628 node = get_node_by_phandle(child, phandle); in get_node_by_phandle()
629 if (node) in get_node_by_phandle()
630 return node; in get_node_by_phandle()
636 struct node *get_node_by_ref(struct node *tree, const char *ref) in get_node_by_ref()
638 struct node *target = tree; in get_node_by_ref()
654 buf = xstrndup(label, slash - label); in get_node_by_ref()
673 static void add_phandle_property(struct node *node, in add_phandle_property() argument
680 if (get_property(node, name)) in add_phandle_property()
684 d = data_append_cell(d, node->phandle); in add_phandle_property()
686 add_property(node, build_property(name, d, NULL)); in add_phandle_property()
689 cell_t get_node_phandle(struct node *root, struct node *node) in get_node_phandle() argument
693 if (phandle_is_valid(node->phandle)) in get_node_phandle()
694 return node->phandle; in get_node_phandle()
699 node->phandle = phandle; in get_node_phandle()
701 add_phandle_property(node, "linux,phandle", PHANDLE_LEGACY); in get_node_phandle()
702 add_phandle_property(node, "phandle", PHANDLE_EPAPR); in get_node_phandle()
704 /* If the node *does* have a phandle property, we must in get_node_phandle()
705 * be dealing with a self-referencing phandle, which will be in get_node_phandle()
708 return node->phandle; in get_node_phandle()
711 uint32_t guess_boot_cpuid(struct node *tree) in guess_boot_cpuid()
713 struct node *cpus, *bootcpu; in guess_boot_cpuid()
721 bootcpu = cpus->children; in guess_boot_cpuid()
726 if (!reg || (reg->val.len != sizeof(uint32_t))) in guess_boot_cpuid()
729 /* FIXME: Sanity check node? */ in guess_boot_cpuid()
741 if (a->address < b->address) in cmp_reserve_info()
742 return -1; in cmp_reserve_info()
743 else if (a->address > b->address) in cmp_reserve_info()
745 else if (a->size < b->size) in cmp_reserve_info()
746 return -1; in cmp_reserve_info()
747 else if (a->size > b->size) in cmp_reserve_info()
758 for (ri = dti->reservelist; in sort_reserve_entries()
760 ri = ri->next) in sort_reserve_entries()
768 for (ri = dti->reservelist; in sort_reserve_entries()
770 ri = ri->next) in sort_reserve_entries()
775 dti->reservelist = tbl[0]; in sort_reserve_entries()
776 for (i = 0; i < (n-1); i++) in sort_reserve_entries()
777 tbl[i]->next = tbl[i+1]; in sort_reserve_entries()
778 tbl[n-1]->next = NULL; in sort_reserve_entries()
790 return strcmp(a->name, b->name); in cmp_prop()
793 static void sort_properties(struct node *node) in sort_properties() argument
798 for_each_property_withdel(node, prop) in sort_properties()
806 for_each_property_withdel(node, prop) in sort_properties()
811 node->proplist = tbl[0]; in sort_properties()
812 for (i = 0; i < (n-1); i++) in sort_properties()
813 tbl[i]->next = tbl[i+1]; in sort_properties()
814 tbl[n-1]->next = NULL; in sort_properties()
821 const struct node *a, *b; in cmp_subnode()
823 a = *((const struct node * const *)ax); in cmp_subnode()
824 b = *((const struct node * const *)bx); in cmp_subnode()
826 return strcmp(a->name, b->name); in cmp_subnode()
829 static void sort_subnodes(struct node *node) in sort_subnodes() argument
832 struct node *subnode, **tbl; in sort_subnodes()
834 for_each_child_withdel(node, subnode) in sort_subnodes()
842 for_each_child_withdel(node, subnode) in sort_subnodes()
847 node->children = tbl[0]; in sort_subnodes()
848 for (i = 0; i < (n-1); i++) in sort_subnodes()
849 tbl[i]->next_sibling = tbl[i+1]; in sort_subnodes()
850 tbl[n-1]->next_sibling = NULL; in sort_subnodes()
855 static void sort_node(struct node *node) in sort_node() argument
857 struct node *c; in sort_node()
859 sort_properties(node); in sort_node()
860 sort_subnodes(node); in sort_node()
861 for_each_child_withdel(node, c) in sort_node()
868 sort_node(dti->dt); in sort_tree()
872 static struct node *build_and_name_child_node(struct node *parent, const char *name) in build_and_name_child_node()
874 struct node *node; in build_and_name_child_node() local
876 node = build_node(NULL, NULL, NULL); in build_and_name_child_node()
877 name_node(node, name); in build_and_name_child_node()
878 add_child(parent, node); in build_and_name_child_node()
880 return node; in build_and_name_child_node()
883 static struct node *build_root_node(struct node *dt, const char *name) in build_root_node()
885 struct node *an; in build_root_node()
892 die("Could not build root node /%s\n", name); in build_root_node()
897 static bool any_label_tree(struct dt_info *dti, struct node *node) in any_label_tree() argument
899 struct node *c; in any_label_tree()
901 if (node->labels) in any_label_tree()
904 for_each_child(node, c) in any_label_tree()
912 struct node *an, struct node *node, in generate_label_tree_internal() argument
915 struct node *dt = dti->dt; in generate_label_tree_internal()
916 struct node *c; in generate_label_tree_internal()
921 if (node->labels) { in generate_label_tree_internal()
923 /* now add the label in the node */ in generate_label_tree_internal()
924 for_each_label(node->labels, l) { in generate_label_tree_internal()
927 p = get_property(an, l->label); in generate_label_tree_internal()
930 " exists in /%s", l->label, in generate_label_tree_internal()
931 an->name); in generate_label_tree_internal()
936 p = build_property(l->label, in generate_label_tree_internal()
937 data_copy_escape_string(node->fullpath, in generate_label_tree_internal()
938 strlen(node->fullpath)), in generate_label_tree_internal()
943 /* force allocation of a phandle for this node */ in generate_label_tree_internal()
945 (void)get_node_phandle(dt, node); in generate_label_tree_internal()
948 for_each_child(node, c) in generate_label_tree_internal()
952 static bool any_fixup_tree(struct dt_info *dti, struct node *node) in any_fixup_tree() argument
954 struct node *c; in any_fixup_tree()
958 for_each_property(node, prop) { in any_fixup_tree()
959 m = prop->val.markers; in any_fixup_tree()
961 if (!get_node_by_ref(dti->dt, m->ref)) in any_fixup_tree()
966 for_each_child(node, c) { in any_fixup_tree()
974 static int add_fixup_entry(struct dt_info *dti, struct node *fn, in add_fixup_entry()
975 struct node *node, struct property *prop, in add_fixup_entry() argument
981 /* m->ref can only be a REF_PHANDLE, but check anyway */ in add_fixup_entry()
982 assert(m->type == REF_PHANDLE); in add_fixup_entry()
986 if (strchr(m->ref, '/')) in add_fixup_entry()
988 m->ref); in add_fixup_entry()
991 if (strchr(node->fullpath, ':') || strchr(prop->name, ':')) in add_fixup_entry()
995 node->fullpath, prop->name, m->offset); in add_fixup_entry()
996 ret = append_unique_str_to_property(fn, m->ref, entry, strlen(entry) + 1); in add_fixup_entry()
1004 struct node *fn, in generate_fixups_tree_internal()
1005 struct node *node) in generate_fixups_tree_internal() argument
1007 struct node *dt = dti->dt; in generate_fixups_tree_internal()
1008 struct node *c; in generate_fixups_tree_internal()
1011 struct node *refnode; in generate_fixups_tree_internal()
1014 for_each_property(node, prop) { in generate_fixups_tree_internal()
1015 m = prop->val.markers; in generate_fixups_tree_internal()
1017 refnode = get_node_by_ref(dt, m->ref); in generate_fixups_tree_internal()
1019 if (add_fixup_entry(dti, fn, node, prop, m)) in generate_fixups_tree_internal()
1020 ret = -1; in generate_fixups_tree_internal()
1024 for_each_child(node, c) in generate_fixups_tree_internal()
1026 ret = -1; in generate_fixups_tree_internal()
1031 static bool any_local_fixup_tree(struct dt_info *dti, struct node *node) in any_local_fixup_tree() argument
1033 struct node *c; in any_local_fixup_tree()
1037 for_each_property(node, prop) { in any_local_fixup_tree()
1038 m = prop->val.markers; in any_local_fixup_tree()
1040 if (get_node_by_ref(dti->dt, m->ref)) in any_local_fixup_tree()
1045 for_each_child(node, c) { in any_local_fixup_tree()
1054 struct node *lfn, struct node *node, in add_local_fixup_entry() argument
1056 struct node *refnode) in add_local_fixup_entry()
1058 struct node *wn, *nwn; /* local fixup node, walk node, new */ in add_local_fixup_entry()
1065 for (wn = node; wn; wn = wn->parent) in add_local_fixup_entry()
1072 for (wn = node, i = depth - 1; wn; wn = wn->parent, i--) in add_local_fixup_entry()
1073 compp[i] = wn->name; in add_local_fixup_entry()
1077 /* if no node exists, create it */ in add_local_fixup_entry()
1083 value_32 = cpu_to_fdt32(m->offset); in add_local_fixup_entry()
1084 return append_unique_u32_to_property(wn, prop->name, value_32); in add_local_fixup_entry()
1088 struct node *lfn, in generate_local_fixups_tree_internal()
1089 struct node *node) in generate_local_fixups_tree_internal() argument
1091 struct node *dt = dti->dt; in generate_local_fixups_tree_internal()
1092 struct node *c; in generate_local_fixups_tree_internal()
1095 struct node *refnode; in generate_local_fixups_tree_internal()
1098 for_each_property(node, prop) { in generate_local_fixups_tree_internal()
1099 m = prop->val.markers; in generate_local_fixups_tree_internal()
1101 refnode = get_node_by_ref(dt, m->ref); in generate_local_fixups_tree_internal()
1103 if (add_local_fixup_entry(dti, lfn, node, prop, m, refnode)) in generate_local_fixups_tree_internal()
1104 ret = -1; in generate_local_fixups_tree_internal()
1108 for_each_child(node, c) in generate_local_fixups_tree_internal()
1110 ret = -1; in generate_local_fixups_tree_internal()
1117 struct node *an; in generate_labels_from_tree()
1120 an = get_subnode(dti->dt, name); in generate_labels_from_tree()
1125 struct node *labeled_node; in generate_labels_from_tree()
1127 labeled_node = get_node_by_path(dti->dt, p->val.val); in generate_labels_from_tree()
1129 add_label(&labeled_node->labels, p->name); in generate_labels_from_tree()
1132 p->val.val, name, p->name); in generate_labels_from_tree()
1138 if (!any_label_tree(dti, dti->dt)) in generate_label_tree()
1140 generate_label_tree_internal(dti, build_root_node(dti->dt, name), in generate_label_tree()
1141 dti->dt, allocph); in generate_label_tree()
1146 if (!any_fixup_tree(dti, dti->dt)) in generate_fixups_tree()
1148 if (generate_fixups_tree_internal(dti, build_root_node(dti->dt, name), dti->dt)) in generate_fixups_tree()
1156 struct node *an; in fixup_phandles()
1159 an = get_subnode(dti->dt, name); in fixup_phandles()
1164 char *fnext = fp->val.val; in fixup_phandles()
1168 while ((fl = fp->val.len - (fnext - fp->val.val))) { in fixup_phandles()
1170 struct node *n; in fixup_phandles()
1180 fp->name); in fixup_phandles()
1185 propname = memchr(fv, ':', fnext - 1 - fv); in fixup_phandles()
1189 fp->name); in fixup_phandles()
1194 soffset = memchr(propname, ':', fnext - 1 - propname); in fixup_phandles()
1198 fp->name); in fixup_phandles()
1205 * a copy for the node path. in fixup_phandles()
1207 *(propname - 1) = '\0'; in fixup_phandles()
1209 n = get_node_by_path(dti->dt, fv); in fixup_phandles()
1211 fprintf(stderr, "Warning: Label %s references non-existing node %s\n", in fixup_phandles()
1212 fp->name, fv); in fixup_phandles()
1214 *(propname - 1) = ':'; in fixup_phandles()
1223 *(soffset - 1) = '\0'; in fixup_phandles()
1228 fprintf(stderr, "Warning: Label %s references non-existing property %s in node %s\n", in fixup_phandles()
1229 fp->name, n->fullpath, propname); in fixup_phandles()
1231 *(soffset - 1) = ':'; in fixup_phandles()
1237 if (offset < 0 || offset + 4 > p->val.len) { in fixup_phandles()
1240 "Warning: Label %s contains invalid offset for property %s in node %s\n", in fixup_phandles()
1241 fp->name, p->name, n->fullpath); in fixup_phandles()
1245 property_add_marker(p, REF_PHANDLE, offset, fp->name); in fixup_phandles()
1252 if (!any_local_fixup_tree(dti, dti->dt)) in generate_local_fixups_tree()
1254 if (generate_local_fixups_tree_internal(dti, build_root_node(dti->dt, name), dti->dt)) in generate_local_fixups_tree()
1260 static void local_fixup_phandles_node(struct dt_info *dti, struct node *lf, struct node *n) in local_fixup_phandles_node()
1263 struct node *lfsubnode; in local_fixup_phandles_node()
1266 struct property *p = get_property(n, lfp->name); in local_fixup_phandles_node()
1267 fdt32_t *offsets = (fdt32_t *)lfp->val.val; in local_fixup_phandles_node()
1273 lfp->name, n->fullpath); in local_fixup_phandles_node()
1281 if (lfp->val.len % sizeof(fdt32_t)) { in local_fixup_phandles_node()
1284 lfp->name, n->fullpath); in local_fixup_phandles_node()
1288 for (i = 0; i < lfp->val.len / sizeof(fdt32_t); i++) in local_fixup_phandles_node()
1293 struct node *subnode = get_subnode(n, lfsubnode->name); in local_fixup_phandles_node()
1297 fprintf(stderr, "Warning: node %s/%s referenced in __local_fixups__ missing\n", in local_fixup_phandles_node()
1298 lfsubnode->name, n->fullpath); in local_fixup_phandles_node()
1308 struct node *an; in local_fixup_phandles()
1310 an = get_subnode(dti->dt, name); in local_fixup_phandles()
1314 local_fixup_phandles_node(dti, an, dti->dt); in local_fixup_phandles()