Lines Matching +full:child +full:- +full:node
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2012 Pantelis Antoniou <panto@antoniou-consulting.com>
25 struct device_node *node; in live_tree_max_phandle() local
31 for_each_of_allnodes(node) { in live_tree_max_phandle()
32 if (node->phandle != OF_PHANDLE_ILLEGAL && in live_tree_max_phandle()
33 node->phandle > phandle) in live_tree_max_phandle()
34 phandle = node->phandle; in live_tree_max_phandle()
44 struct device_node *child; in adjust_overlay_phandles() local
48 /* adjust node's phandle in node */ in adjust_overlay_phandles()
49 if (overlay->phandle != 0 && overlay->phandle != OF_PHANDLE_ILLEGAL) in adjust_overlay_phandles()
50 overlay->phandle += phandle_delta; in adjust_overlay_phandles()
55 if (of_prop_cmp(prop->name, "phandle") && in adjust_overlay_phandles()
56 of_prop_cmp(prop->name, "linux,phandle")) in adjust_overlay_phandles()
59 if (prop->length < 4) in adjust_overlay_phandles()
62 phandle = be32_to_cpup(prop->value); in adjust_overlay_phandles()
66 *(__be32 *)prop->value = cpu_to_be32(overlay->phandle); in adjust_overlay_phandles()
69 for_each_child_of_node(overlay, child) in adjust_overlay_phandles()
70 adjust_overlay_phandles(child, phandle_delta); in adjust_overlay_phandles()
78 char *value __free(kfree) = kmemdup(prop_fixup->value, prop_fixup->length, GFP_KERNEL); in update_usages_of_a_phandle_reference()
84 return -ENOMEM; in update_usages_of_a_phandle_reference()
87 end = value + prop_fixup->length; in update_usages_of_a_phandle_reference()
94 return -EINVAL; in update_usages_of_a_phandle_reference()
100 return -EINVAL; in update_usages_of_a_phandle_reference()
112 if (!of_prop_cmp(prop->name, prop_name)) in update_usages_of_a_phandle_reference()
118 return -ENOENT; in update_usages_of_a_phandle_reference()
120 if (offset < 0 || offset + sizeof(__be32) > prop->length) in update_usages_of_a_phandle_reference()
121 return -EINVAL; in update_usages_of_a_phandle_reference()
123 *(__be32 *)(prop->value + offset) = cpu_to_be32(phandle); in update_usages_of_a_phandle_reference()
133 const char *n1 = kbasename(dn1->full_name); in node_name_cmp()
134 const char *n2 = kbasename(dn2->full_name); in node_name_cmp()
142 * Subtree @local_fixups, which is overlay node __local_fixups__,
143 * mirrors the fragment node structure at the root of the overlay.
164 if (!of_prop_cmp(prop_fix->name, "name") || in adjust_local_phandle_references()
165 !of_prop_cmp(prop_fix->name, "phandle") || in adjust_local_phandle_references()
166 !of_prop_cmp(prop_fix->name, "linux,phandle")) in adjust_local_phandle_references()
169 if ((prop_fix->length % 4) != 0 || prop_fix->length == 0) in adjust_local_phandle_references()
170 return -EINVAL; in adjust_local_phandle_references()
171 count = prop_fix->length / sizeof(__be32); in adjust_local_phandle_references()
174 if (!of_prop_cmp(prop->name, prop_fix->name)) in adjust_local_phandle_references()
179 return -EINVAL; in adjust_local_phandle_references()
182 off = be32_to_cpu(((__be32 *)prop_fix->value)[i]); in adjust_local_phandle_references()
183 if ((off + 4) > prop->length) in adjust_local_phandle_references()
184 return -EINVAL; in adjust_local_phandle_references()
186 be32_add_cpu(prop->value + off, phandle_delta); in adjust_local_phandle_references()
192 * node names in the two subtrees match. in adjust_local_phandle_references()
194 * The roots of the subtrees are the overlay's __local_fixups__ node in adjust_local_phandle_references()
195 * and the overlay's root node. in adjust_local_phandle_references()
197 for_each_child_of_node_scoped(local_fixups, child) { in adjust_local_phandle_references()
200 if (!node_name_cmp(child, overlay_child)) { in adjust_local_phandle_references()
206 return -EINVAL; in adjust_local_phandle_references()
208 err = adjust_local_phandle_references(child, overlay_child, in adjust_local_phandle_references()
218 * of_resolve_phandles - Relocate and resolve overlay against live tree
233 * The name of each property in the "__fixups__" node in the overlay matches
235 * property in the "__fixups__" node is a list of the property values in the
252 struct device_node *child, *local_fixups, *refnode; in of_resolve_phandles() local
263 err = -EINVAL; in of_resolve_phandles()
269 err = -EINVAL; in of_resolve_phandles()
286 for_each_child_of_node(overlay, child) { in of_resolve_phandles()
287 if (of_node_name_eq(child, "__fixups__")) in of_resolve_phandles()
288 overlay_fixups = child; in of_resolve_phandles()
299 err = -EINVAL; in of_resolve_phandles()
306 if (!of_prop_cmp(prop->name, "name")) in of_resolve_phandles()
310 prop->name, &refpath); in of_resolve_phandles()
312 pr_err("node label '%s' not found in live devicetree symbols table\n", in of_resolve_phandles()
313 prop->name); in of_resolve_phandles()
319 err = -ENOENT; in of_resolve_phandles()
323 phandle = refnode->phandle; in of_resolve_phandles()