Lines Matching +full:child +full:- +full:node
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2012 Pantelis Antoniou <panto@antoniou-consulting.com>
24 struct device_node *node; in live_tree_max_phandle() local
30 for_each_of_allnodes(node) { in live_tree_max_phandle()
31 if (node->phandle != OF_PHANDLE_ILLEGAL && in live_tree_max_phandle()
32 node->phandle > phandle) in live_tree_max_phandle()
33 phandle = node->phandle; in live_tree_max_phandle()
43 struct device_node *child; in adjust_overlay_phandles() local
47 /* adjust node's phandle in node */ in adjust_overlay_phandles()
48 if (overlay->phandle != 0 && overlay->phandle != OF_PHANDLE_ILLEGAL) in adjust_overlay_phandles()
49 overlay->phandle += phandle_delta; in adjust_overlay_phandles()
54 if (of_prop_cmp(prop->name, "phandle") && in adjust_overlay_phandles()
55 of_prop_cmp(prop->name, "linux,phandle")) in adjust_overlay_phandles()
58 if (prop->length < 4) in adjust_overlay_phandles()
61 phandle = be32_to_cpup(prop->value); in adjust_overlay_phandles()
65 *(__be32 *)prop->value = cpu_to_be32(overlay->phandle); in adjust_overlay_phandles()
68 for_each_child_of_node(overlay, child) in adjust_overlay_phandles()
69 adjust_overlay_phandles(child, phandle_delta); in adjust_overlay_phandles()
81 value = kmemdup(prop_fixup->value, prop_fixup->length, GFP_KERNEL); in update_usages_of_a_phandle_reference()
83 return -ENOMEM; in update_usages_of_a_phandle_reference()
86 end = value + prop_fixup->length; in update_usages_of_a_phandle_reference()
93 err = -EINVAL; in update_usages_of_a_phandle_reference()
101 err = -EINVAL; in update_usages_of_a_phandle_reference()
115 if (!of_prop_cmp(prop->name, prop_name)) in update_usages_of_a_phandle_reference()
121 err = -ENOENT; in update_usages_of_a_phandle_reference()
125 if (offset < 0 || offset + sizeof(__be32) > prop->length) { in update_usages_of_a_phandle_reference()
126 err = -EINVAL; in update_usages_of_a_phandle_reference()
130 *(__be32 *)(prop->value + offset) = cpu_to_be32(phandle); in update_usages_of_a_phandle_reference()
142 const char *n1 = kbasename(dn1->full_name); in node_name_cmp()
143 const char *n2 = kbasename(dn2->full_name); in node_name_cmp()
151 * Subtree @local_fixups, which is overlay node __local_fixups__,
152 * mirrors the fragment node structure at the root of the overlay.
162 struct device_node *child, *overlay_child; in adjust_local_phandle_references() local
173 if (!of_prop_cmp(prop_fix->name, "name") || in adjust_local_phandle_references()
174 !of_prop_cmp(prop_fix->name, "phandle") || in adjust_local_phandle_references()
175 !of_prop_cmp(prop_fix->name, "linux,phandle")) in adjust_local_phandle_references()
178 if ((prop_fix->length % 4) != 0 || prop_fix->length == 0) in adjust_local_phandle_references()
179 return -EINVAL; in adjust_local_phandle_references()
180 count = prop_fix->length / sizeof(__be32); in adjust_local_phandle_references()
183 if (!of_prop_cmp(prop->name, prop_fix->name)) in adjust_local_phandle_references()
188 return -EINVAL; in adjust_local_phandle_references()
191 off = be32_to_cpu(((__be32 *)prop_fix->value)[i]); in adjust_local_phandle_references()
192 if ((off + 4) > prop->length) in adjust_local_phandle_references()
193 return -EINVAL; in adjust_local_phandle_references()
195 be32_add_cpu(prop->value + off, phandle_delta); in adjust_local_phandle_references()
201 * node names in the two subtrees match. in adjust_local_phandle_references()
203 * The roots of the subtrees are the overlay's __local_fixups__ node in adjust_local_phandle_references()
204 * and the overlay's root node. in adjust_local_phandle_references()
206 for_each_child_of_node(local_fixups, child) { in adjust_local_phandle_references()
209 if (!node_name_cmp(child, overlay_child)) { in adjust_local_phandle_references()
215 of_node_put(child); in adjust_local_phandle_references()
216 return -EINVAL; in adjust_local_phandle_references()
219 err = adjust_local_phandle_references(child, overlay_child, in adjust_local_phandle_references()
222 of_node_put(child); in adjust_local_phandle_references()
231 * of_resolve_phandles - Relocate and resolve overlay against live tree
246 * The name of each property in the "__fixups__" node in the overlay matches
248 * property in the "__fixups__" node is a list of the property values in the
265 struct device_node *child, *local_fixups, *refnode; in of_resolve_phandles() local
276 err = -EINVAL; in of_resolve_phandles()
282 err = -EINVAL; in of_resolve_phandles()
299 for_each_child_of_node(overlay, child) { in of_resolve_phandles()
300 if (of_node_name_eq(child, "__fixups__")) in of_resolve_phandles()
301 overlay_fixups = child; in of_resolve_phandles()
312 err = -EINVAL; in of_resolve_phandles()
319 if (!of_prop_cmp(prop->name, "name")) in of_resolve_phandles()
323 prop->name, &refpath); in of_resolve_phandles()
325 pr_err("node label '%s' not found in live devicetree symbols table\n", in of_resolve_phandles()
326 prop->name); in of_resolve_phandles()
332 err = -ENOENT; in of_resolve_phandles()
336 phandle = refnode->phandle; in of_resolve_phandles()