Lines Matching +full:child +full:- +full:node
1 // SPDX-License-Identifier: GPL-2.0+
6 * Copyright (C) 1996-2005 Paul Mackerras.
54 /* use when traversing tree through the child, sibling,
67 node_name = kbasename(np->full_name); in of_node_name_eq()
68 len = strchrnul(node_name, '@') - node_name; in of_node_name_eq()
79 return strncmp(kbasename(np->full_name), prefix, strlen(prefix)) == 0; in of_node_name_prefix()
99 for (; np; np = np->parent) { in of_bus_n_addr_cells()
100 if (!of_property_read_u32(np, "#address-cells", &cells)) in of_bus_n_addr_cells()
103 * Default root value and walking parent nodes for "#address-cells" in of_bus_n_addr_cells()
108 "Missing '#address-cells' in %pOF\n", np); in of_bus_n_addr_cells()
115 if (np->parent) in of_n_addr_cells()
116 np = np->parent; in of_n_addr_cells()
126 for (; np; np = np->parent) { in of_bus_n_size_cells()
127 if (!of_property_read_u32(np, "#size-cells", &cells)) in of_bus_n_size_cells()
130 * Default root value and walking parent nodes for "#size-cells" in of_bus_n_size_cells()
135 "Missing '#size-cells' in %pOF\n", np); in of_bus_n_size_cells()
142 if (np->parent) in of_n_size_cells()
143 np = np->parent; in of_n_size_cells()
180 if (np && handle == np->phandle) in __of_phandle_cache_inv_entry()
200 if (np->phandle && !phandle_cache[of_phandle_cache_hash(np->phandle)]) in of_core_init()
201 phandle_cache[of_phandle_cache_hash(np->phandle)] = np; in of_core_init()
207 proc_symlink("device-tree", NULL, "/sys/firmware/devicetree/base"); in of_core_init()
218 for (pp = np->properties; pp; pp = pp->next) { in __of_find_property()
219 if (of_prop_cmp(pp->name, name) == 0) { in __of_find_property()
221 *lenp = pp->length; in __of_find_property()
249 } else if (prev->child) { in __of_find_all_nodes()
250 np = prev->child; in __of_find_all_nodes()
254 while (np->parent && !np->sibling) in __of_find_all_nodes()
255 np = np->parent; in __of_find_all_nodes()
256 np = np->sibling; /* Might be null at the end of the tree */ in __of_find_all_nodes()
262 * of_find_all_nodes - Get next node in global list
263 * @prev: Previous node or NULL to start iteration
266 * Return: A node pointer with refcount incremented, use
284 * Find a property with a given name for a given node
292 return pp ? pp->value : NULL; in __of_get_property()
296 * Find a property with a given name for a given node
304 return pp ? pp->value : NULL; in of_get_property()
309 * __of_device_is_compatible() - Check if the node matches given constraints
310 * @device: pointer to node
313 * @name: required node name, NULL or "" for any match
351 score = INT_MAX/2 - (index << 2); in __of_device_is_compatible()
416 * of_machine_compatible_match - Test root of device tree against a compatible array
417 …* @compats: NULL terminated array of compatible strings to look for in root node's compatible prop…
419 * Returns true if the root node has any of the given compatible values in its
438 * of_machine_device_match - Test root of device tree against a of_device_id array
441 * Returns true if the root node has any of the given compatible values in its
460 * of_machine_get_match_data - Tell if root of device tree has a matching of_match structure
480 return match->data; in of_machine_get_match_data()
501 if ((*strings)[len - 1] == '-') { in __of_device_is_status()
516 * __of_device_is_available - check if a device is available for use
518 * @device: Node to check for availability, with locks already held
535 * __of_device_is_reserved - check if a device is reserved
537 * @device: Node to check for availability, with locks already held
549 * of_device_is_available - check if a device is available for use
551 * @device: Node to check for availability
570 * __of_device_is_fail - check if a device has status "fail" or "fail-..."
572 * @device: Node to check status for, with locks already held
574 * Return: True if the status property is set to "fail" or "fail-..." (for any
579 static const char * const fail[] = {"fail", "fail-", NULL}; in __of_device_is_fail()
585 * of_device_is_big_endian - check if a device has BE registers
587 * @device: Node to check for endianness
589 * Return: True if the device has a "big-endian" property, or if the kernel
590 * was compiled for BE *and* the device has a "native-endian" property.
598 if (of_property_read_bool(device, "big-endian")) in of_device_is_big_endian()
601 of_property_read_bool(device, "native-endian")) in of_device_is_big_endian()
608 * of_get_parent - Get a node's parent if any
609 * @node: Node to get parent
611 * Return: A node pointer with refcount incremented, use
614 struct device_node *of_get_parent(const struct device_node *node) in of_get_parent() argument
619 if (!node) in of_get_parent()
623 np = of_node_get(node->parent); in of_get_parent()
630 * of_get_next_parent - Iterate to a node's parent
631 * @node: Node to get parent of
634 * refcount on the passed node, making it suitable for iterating
635 * through a node's parents.
637 * Return: A node pointer with refcount incremented, use
640 struct device_node *of_get_next_parent(struct device_node *node) in of_get_next_parent() argument
645 if (!node) in of_get_next_parent()
649 parent = of_node_get(node->parent); in of_get_next_parent()
650 of_node_put(node); in of_get_next_parent()
656 static struct device_node *__of_get_next_child(const struct device_node *node, in __of_get_next_child() argument
661 if (!node) in __of_get_next_child()
664 next = prev ? prev->sibling : node->child; in __of_get_next_child()
669 #define __for_each_child_of_node(parent, child) \ argument
670 for (child = __of_get_next_child(parent, NULL); child != NULL; \
671 child = __of_get_next_child(parent, child))
674 * of_get_next_child - Iterate a node childs
675 * @node: parent node
676 * @prev: previous child of the parent node, or NULL to get first
678 * Return: A node pointer with refcount incremented, use of_node_put() on
679 * it when done. Returns NULL when prev is the last child. Decrements the
682 struct device_node *of_get_next_child(const struct device_node *node, in of_get_next_child() argument
689 next = __of_get_next_child(node, prev); in of_get_next_child()
696 * of_get_next_child_with_prefix - Find the next child node with prefix
697 * @node: parent node
698 * @prev: previous child of the parent node, or NULL to get first
699 * @prefix: prefix that the node name should have
704 * Return: A node pointer with refcount incremented, use
707 struct device_node *of_get_next_child_with_prefix(const struct device_node *node, in of_get_next_child_with_prefix() argument
714 if (!node) in of_get_next_child_with_prefix()
718 next = prev ? prev->sibling : node->child; in of_get_next_child_with_prefix()
719 for (; next; next = next->sibling) { in of_get_next_child_with_prefix()
731 static struct device_node *of_get_next_status_child(const struct device_node *node, in of_get_next_status_child() argument
738 if (!node) in of_get_next_status_child()
742 next = prev ? prev->sibling : node->child; in of_get_next_status_child()
743 for (; next; next = next->sibling) { in of_get_next_status_child()
755 * of_get_next_available_child - Find the next available child node
756 * @node: parent node
757 * @prev: previous child of the parent node, or NULL to get first
762 struct device_node *of_get_next_available_child(const struct device_node *node, in of_get_next_available_child() argument
765 return of_get_next_status_child(node, prev, __of_device_is_available); in of_get_next_available_child()
770 * of_get_next_reserved_child - Find the next reserved child node
771 * @node: parent node
772 * @prev: previous child of the parent node, or NULL to get first
777 struct device_node *of_get_next_reserved_child(const struct device_node *node, in of_get_next_reserved_child() argument
780 return of_get_next_status_child(node, prev, __of_device_is_reserved); in of_get_next_reserved_child()
785 * of_get_next_cpu_node - Iterate on cpu nodes
786 * @prev: previous child of the /cpus node, or NULL to get first
788 * Unusable CPUs (those with the status property set to "fail" or "fail-...")
791 * Return: A cpu node pointer with refcount incremented, use of_node_put()
792 * on it when done. Returns NULL when prev is the last child. Decrements
799 struct device_node *node; in of_get_next_cpu_node() local
802 node = of_find_node_by_path("/cpus"); in of_get_next_cpu_node()
806 next = prev->sibling; in of_get_next_cpu_node()
807 else if (node) { in of_get_next_cpu_node()
808 next = node->child; in of_get_next_cpu_node()
809 of_node_put(node); in of_get_next_cpu_node()
811 for (; next; next = next->sibling) { in of_get_next_cpu_node()
827 * of_get_compatible_child - Find compatible child node
828 * @parent: parent node
831 * Lookup child node whose compatible property contains the given compatible
834 * Return: a node pointer with refcount incremented, use of_node_put() on it
840 struct device_node *child; in of_get_compatible_child() local
842 for_each_child_of_node(parent, child) { in of_get_compatible_child()
843 if (of_device_is_compatible(child, compatible)) in of_get_compatible_child()
847 return child; in of_get_compatible_child()
852 * of_get_child_by_name - Find the child node by name for a given parent
853 * @node: parent node
854 * @name: child name to look for.
856 * This function looks for child node for given matching name
858 * Return: A node pointer if found, with refcount incremented, use
860 * Returns NULL if node is not found.
862 struct device_node *of_get_child_by_name(const struct device_node *node, in of_get_child_by_name() argument
865 struct device_node *child; in of_get_child_by_name() local
867 for_each_child_of_node(node, child) in of_get_child_by_name()
868 if (of_node_name_eq(child, name)) in of_get_child_by_name()
870 return child; in of_get_child_by_name()
875 * of_get_available_child_by_name - Find the available child node by name for a given parent
876 * @node: parent node
877 * @name: child name to look for.
879 * This function looks for child node for given matching name and checks the
882 * Return: A node pointer if found, with refcount incremented, use
884 * Returns NULL if node is not found.
886 struct device_node *of_get_available_child_by_name(const struct device_node *node, in of_get_available_child_by_name() argument
889 struct device_node *child; in of_get_available_child_by_name() local
891 child = of_get_child_by_name(node, name); in of_get_available_child_by_name()
892 if (child && !of_device_is_available(child)) { in of_get_available_child_by_name()
893 of_node_put(child); in of_get_available_child_by_name()
897 return child; in of_get_available_child_by_name()
904 struct device_node *child; in __of_find_node_by_path() local
911 __for_each_child_of_node(parent, child) { in __of_find_node_by_path()
912 const char *name = kbasename(child->full_name); in __of_find_node_by_path()
914 return child; in __of_find_node_by_path()
919 struct device_node *__of_find_node_by_full_path(struct device_node *node, in __of_find_node_by_full_path() argument
924 while (node && *path == '/') { in __of_find_node_by_full_path()
925 struct device_node *tmp = node; in __of_find_node_by_full_path()
928 node = __of_find_node_by_path(node, path); in __of_find_node_by_full_path()
934 return node; in __of_find_node_by_full_path()
938 * of_find_node_opts_by_path - Find a node matching a full OF path
941 * node (an alias). In the case of an alias, the node
952 * Return: A node pointer with refcount incremented, use
975 len = p - path; in of_find_node_opts_by_path()
982 if (strlen(pp->name) == len && !strncmp(pp->name, path, len)) { in of_find_node_opts_by_path()
983 np = of_find_node_by_path(pp->value); in of_find_node_opts_by_path()
1003 * of_find_node_by_name - Find a node by its "name" property
1004 * @from: The node to start searching from or NULL; the node
1010 * Return: A node pointer with refcount incremented, use
1030 * of_find_node_by_type - Find a node by its "device_type" property
1031 * @from: The node to start searching from, or NULL to start searching
1032 * the entire device tree. The node you pass will not be
1038 * Return: A node pointer with refcount incremented, use
1058 * of_find_compatible_node - Find a node based on type and one of the
1060 * @from: The node to start searching from or NULL, the node
1068 * Return: A node pointer with refcount incremented, use
1089 * of_find_node_with_property - Find a node which has a property with
1091 * @from: The node to start searching from or NULL, the node
1097 * Return: A node pointer with refcount incremented, use
1121 const struct device_node *node) in __of_match_node() argument
1129 for (; matches->name[0] || matches->type[0] || matches->compatible[0]; matches++) { in __of_match_node()
1130 score = __of_device_is_compatible(node, matches->compatible, in __of_match_node()
1131 matches->type, matches->name); in __of_match_node()
1142 * of_match_node - Tell if a device_node has a matching of_match structure
1144 * @node: the of device structure to match against
1149 const struct device_node *node) in of_match_node() argument
1155 match = __of_match_node(matches, node); in of_match_node()
1162 * of_find_matching_node_and_match - Find a node based on an of_device_id
1164 * @from: The node to start searching from or NULL, the node
1171 * Return: A node pointer with refcount incremented, use
1201 * of_alias_from_compatible - Lookup appropriate alias for a device node
1203 * @node: pointer to a device tree node
1208 * to choose an appropriate alias value for a particular device tree node.
1217 int of_alias_from_compatible(const struct device_node *node, char *alias, int len) in of_alias_from_compatible() argument
1222 compatible = of_get_property(node, "compatible", &cplen); in of_alias_from_compatible()
1224 return -ENODEV; in of_alias_from_compatible()
1232 * of_find_node_by_phandle - Find a node given a phandle
1233 * @handle: phandle of the node to find
1235 * Return: A node pointer with refcount incremented, use
1252 handle == phandle_cache[handle_hash]->phandle) in of_find_node_by_phandle()
1257 if (np->phandle == handle && in of_find_node_by_phandle()
1273 printk("%s %pOF", msg, args->np); in of_print_phandle_args()
1274 for (i = 0; i < args->args_count; i++) { in of_print_phandle_args()
1277 pr_cont("%c%08x", delim, args->args[i]); in of_print_phandle_args()
1298 return -EINVAL; in of_phandle_iterator_init()
1302 return -ENOENT; in of_phandle_iterator_init()
1304 it->cells_name = cells_name; in of_phandle_iterator_init()
1305 it->cell_count = cell_count; in of_phandle_iterator_init()
1306 it->parent = np; in of_phandle_iterator_init()
1307 it->list_end = list + size / sizeof(*list); in of_phandle_iterator_init()
1308 it->phandle_end = list; in of_phandle_iterator_init()
1309 it->cur = list; in of_phandle_iterator_init()
1319 if (it->node) { in of_phandle_iterator_next()
1320 of_node_put(it->node); in of_phandle_iterator_next()
1321 it->node = NULL; in of_phandle_iterator_next()
1324 if (!it->cur || it->phandle_end >= it->list_end) in of_phandle_iterator_next()
1325 return -ENOENT; in of_phandle_iterator_next()
1327 it->cur = it->phandle_end; in of_phandle_iterator_next()
1330 it->phandle = be32_to_cpup(it->cur++); in of_phandle_iterator_next()
1332 if (it->phandle) { in of_phandle_iterator_next()
1335 * Find the provider node and parse the #*-cells property to in of_phandle_iterator_next()
1338 it->node = of_find_node_by_phandle(it->phandle); in of_phandle_iterator_next()
1340 if (it->cells_name) { in of_phandle_iterator_next()
1341 if (!it->node) { in of_phandle_iterator_next()
1343 it->parent, it->phandle); in of_phandle_iterator_next()
1347 if (of_property_read_u32(it->node, it->cells_name, in of_phandle_iterator_next()
1354 if (it->cell_count >= 0) { in of_phandle_iterator_next()
1355 count = it->cell_count; in of_phandle_iterator_next()
1358 it->parent, in of_phandle_iterator_next()
1359 it->cells_name, in of_phandle_iterator_next()
1360 it->node); in of_phandle_iterator_next()
1365 count = it->cell_count; in of_phandle_iterator_next()
1372 if (it->cur + count > it->list_end) { in of_phandle_iterator_next()
1373 if (it->cells_name) in of_phandle_iterator_next()
1375 it->parent, it->cells_name, in of_phandle_iterator_next()
1376 count, it->list_end - it->cur); in of_phandle_iterator_next()
1379 it->parent, of_node_full_name(it->node), in of_phandle_iterator_next()
1380 count, it->list_end - it->cur); in of_phandle_iterator_next()
1385 it->phandle_end = it->cur + count; in of_phandle_iterator_next()
1386 it->cur_count = count; in of_phandle_iterator_next()
1391 if (it->node) { in of_phandle_iterator_next()
1392 of_node_put(it->node); in of_phandle_iterator_next()
1393 it->node = NULL; in of_phandle_iterator_next()
1396 return -EINVAL; in of_phandle_iterator_next()
1406 count = it->cur_count; in of_phandle_iterator_args()
1412 args[i] = be32_to_cpup(it->cur++); in of_phandle_iterator_args()
1427 return -EINVAL; in __of_parse_phandle_with_args()
1435 * or return -ENOENT for an empty entry. in __of_parse_phandle_with_args()
1437 rc = -ENOENT; in __of_parse_phandle_with_args()
1446 out_args->args, in __of_parse_phandle_with_args()
1448 out_args->np = it.node; in __of_parse_phandle_with_args()
1449 out_args->args_count = c; in __of_parse_phandle_with_args()
1451 of_node_put(it.node); in __of_parse_phandle_with_args()
1462 * Unlock node before returning result; will be one of: in __of_parse_phandle_with_args()
1463 * -ENOENT : index is for empty phandle in __of_parse_phandle_with_args()
1464 * -EINVAL : parsing error on data in __of_parse_phandle_with_args()
1468 of_node_put(it.node); in __of_parse_phandle_with_args()
1474 * of_parse_phandle_with_args_map() - Find a node pointed by phandle in a list and remap it
1475 * @np: pointer to a device tree node containing a list
1484 * is that this API remaps a phandle if the node the phandle points to has
1485 * a <@stem_name>-map property.
1487 * Caller is responsible to call of_node_put() on the returned out_args->np
1493 * #list-cells = <2>;
1497 * #list-cells = <1>;
1501 * #list-cells = <1>;
1502 * list-map = <0 &phandle2 3>,
1505 * list-map-mask = <0x3>;
1512 * To get a device_node of the ``node2`` node you may call this:
1520 char *cells_name __free(kfree) = kasprintf(GFP_KERNEL, "#%s-cells", stem_name); in of_parse_phandle_with_args_map()
1521 char *map_name __free(kfree) = kasprintf(GFP_KERNEL, "%s-map", stem_name); in of_parse_phandle_with_args_map()
1522 char *mask_name __free(kfree) = kasprintf(GFP_KERNEL, "%s-map-mask", stem_name); in of_parse_phandle_with_args_map()
1523 char *pass_name __free(kfree) = kasprintf(GFP_KERNEL, "%s-map-pass-thru", stem_name); in of_parse_phandle_with_args_map()
1526 static const __be32 dummy_mask[] = { [0 ... (MAX_PHANDLE_ARGS - 1)] = cpu_to_be32(~0) }; in of_parse_phandle_with_args_map()
1527 static const __be32 dummy_pass[] = { [0 ... (MAX_PHANDLE_ARGS - 1)] = cpu_to_be32(0) }; in of_parse_phandle_with_args_map()
1534 return -EINVAL; in of_parse_phandle_with_args_map()
1537 return -ENOMEM; in of_parse_phandle_with_args_map()
1539 ret = __of_parse_phandle_with_args(np, list_name, cells_name, -1, index, in of_parse_phandle_with_args_map()
1544 /* Get the #<list>-cells property */ in of_parse_phandle_with_args_map()
1545 cur = out_args->np; in of_parse_phandle_with_args_map()
1550 /* Precalculate the match array - this simplifies match loop */ in of_parse_phandle_with_args_map()
1552 initial_match_array[i] = cpu_to_be32(out_args->args[i]); in of_parse_phandle_with_args_map()
1554 ret = -EINVAL; in of_parse_phandle_with_args_map()
1556 /* Get the <list>-map property */ in of_parse_phandle_with_args_map()
1563 /* Get the <list>-map-mask property (optional) */ in of_parse_phandle_with_args_map()
1567 /* Iterate through <list>-map property */ in of_parse_phandle_with_args_map()
1572 for (i = 0; i < list_size; i++, map_len--) in of_parse_phandle_with_args_map()
1578 map_len--; in of_parse_phandle_with_args_map()
1582 ret = -EINVAL; in of_parse_phandle_with_args_map()
1596 ret = -EINVAL; in of_parse_phandle_with_args_map()
1600 /* Move forward by new node's #<list>-cells amount */ in of_parse_phandle_with_args_map()
1602 map_len -= new_size; in of_parse_phandle_with_args_map()
1605 ret = -ENOENT; in of_parse_phandle_with_args_map()
1609 /* Get the <list>-map-pass-thru property (optional) */ in of_parse_phandle_with_args_map()
1615 * Successfully parsed a <list>-map translation; copy new in of_parse_phandle_with_args_map()
1617 * bits specified in <list>-map-pass-thru. in of_parse_phandle_with_args_map()
1620 __be32 val = *(map - new_size + i); in of_parse_phandle_with_args_map()
1624 val |= cpu_to_be32(out_args->args[i]) & pass[i]; in of_parse_phandle_with_args_map()
1628 out_args->args[i] = be32_to_cpu(val); in of_parse_phandle_with_args_map()
1630 out_args->args_count = list_size = new_size; in of_parse_phandle_with_args_map()
1632 out_args->np = new; in of_parse_phandle_with_args_map()
1645 * of_count_phandle_with_args() - Find the number of phandles references in a property
1646 * @np: pointer to a device tree node containing a list
1653 * by a property in the phandle-target node. For example, a gpios
1656 * determined by the #gpio-cells property in the node pointed to by the
1677 return -ENOENT; in of_count_phandle_with_args()
1682 rc = of_phandle_iterator_init(&it, np, list_name, cells_name, -1); in of_count_phandle_with_args()
1689 if (rc != -ENOENT) in of_count_phandle_with_args()
1700 for (next = list; *next; next = &(*next)->next) { in __of_remove_property_from_list()
1702 *next = prop->next; in __of_remove_property_from_list()
1703 prop->next = NULL; in __of_remove_property_from_list()
1711 * __of_add_property - Add a property to a node without lock operations
1712 * @np: Caller's Device Node
1723 __of_remove_property_from_list(&np->deadprops, prop); in __of_add_property()
1725 prop->next = NULL; in __of_add_property()
1726 next = &np->properties; in __of_add_property()
1728 if (of_prop_cmp(prop->name, (*next)->name) == 0) { in __of_add_property()
1730 rc = -EEXIST; in __of_add_property()
1733 next = &(*next)->next; in __of_add_property()
1747 * of_add_property - Add a property to a node
1748 * @np: Caller's Device Node
1769 int rc = -ENODEV; in __of_remove_property()
1773 if (__of_remove_property_from_list(&np->properties, prop)) { in __of_remove_property()
1775 prop->next = np->deadprops; in __of_remove_property()
1776 np->deadprops = prop; in __of_remove_property()
1789 * of_remove_property - Remove a property from a node.
1790 * @np: Caller's Device Node
1794 * who-knows-how-many pointers to the data using get-property.
1803 return -ENODEV; in of_remove_property()
1824 __of_remove_property_from_list(&np->deadprops, newprop); in __of_update_property()
1826 for (next = &np->properties; *next; next = &(*next)->next) { in __of_update_property()
1827 if (of_prop_cmp((*next)->name, newprop->name) == 0) in __of_update_property()
1833 /* replace the node */ in __of_update_property()
1834 newprop->next = oldprop->next; in __of_update_property()
1836 oldprop->next = np->deadprops; in __of_update_property()
1837 np->deadprops = oldprop; in __of_update_property()
1839 /* new node */ in __of_update_property()
1840 newprop->next = NULL; in __of_update_property()
1852 * of_update_property - Update a property in a node, if the property does
1856 * who-knows-how-many pointers to the data using get-property.
1865 if (!newprop->name) in of_update_property()
1866 return -EINVAL; in of_update_property()
1881 ap->np = np; in of_alias_add()
1882 ap->id = id; in of_alias_add()
1883 strscpy(ap->stem, stem, stem_len + 1); in of_alias_add()
1884 list_add_tail(&ap->link, &aliases_lookup); in of_alias_add()
1885 pr_debug("adding DT alias:%s: stem=%s id=%i node=%pOF\n", in of_alias_add()
1886 ap->alias, ap->stem, ap->id, np); in of_alias_add()
1890 * of_alias_scan - Scan all properties of the 'aliases' node
1894 * The function scans all the properties of the 'aliases' node and populates
1907 /* linux,stdout-path and /aliases/stdout are for legacy compatibility */ in of_alias_scan()
1910 if (of_property_read_string(of_chosen, "stdout-path", &name)) in of_alias_scan()
1911 of_property_read_string(of_chosen, "linux,stdout-path", in of_alias_scan()
1918 of_stdout->fwnode.flags |= FWNODE_FLAG_BEST_EFFORT; in of_alias_scan()
1925 const char *start = pp->name; in of_alias_scan()
1932 if (is_pseudo_property(pp->name)) in of_alias_scan()
1935 np = of_find_node_by_path(pp->value); in of_alias_scan()
1941 while (isdigit(*(end-1)) && end > start) in of_alias_scan()
1942 end--; in of_alias_scan()
1943 len = end - start; in of_alias_scan()
1957 ap->alias = start; in of_alias_scan()
1963 * of_alias_get_id - Get alias id for the given device_node
1975 int id = -ENODEV; in of_alias_get_id()
1979 if (strcmp(app->stem, stem) != 0) in of_alias_get_id()
1982 if (np == app->np) { in of_alias_get_id()
1983 id = app->id; in of_alias_get_id()
1994 * of_alias_get_highest_id - Get highest alias id for the given stem
2003 int id = -ENODEV; in of_alias_get_highest_id()
2007 if (strcmp(app->stem, stem) != 0) in of_alias_get_highest_id()
2010 if (app->id > id) in of_alias_get_highest_id()
2011 id = app->id; in of_alias_get_highest_id()
2020 * of_console_check() - Test and setup console for DT setup
2021 * @dn: Pointer to device node
2025 * Check if the given device node matches the stdout-path property in the
2026 * /chosen node. If it does then register it as the preferred console.
2044 * of_find_next_cache_node - Find a node's subsidiary cache
2045 * @np: node of type "cpu" or "cache"
2047 * Return: A node pointer with refcount incremented, use
2053 struct device_node *child, *cache_node; in of_find_next_cache_node() local
2055 cache_node = of_parse_phandle(np, "l2-cache", 0); in of_find_next_cache_node()
2057 cache_node = of_parse_phandle(np, "next-level-cache", 0); in of_find_next_cache_node()
2062 /* OF on pmac has nodes instead of properties named "l2-cache" in of_find_next_cache_node()
2066 for_each_child_of_node(np, child) in of_find_next_cache_node()
2067 if (of_node_is_type(child, "cache")) in of_find_next_cache_node()
2068 return child; in of_find_next_cache_node()
2074 * of_find_last_cache_level - Find the level at which the last cache is
2093 of_property_read_u32(prev, "cache-level", &cache_level); in of_find_last_cache_level()
2100 * of_map_id - Translate an ID through a downstream mapping.
2101 * @np: root complex device node.
2105 * @target: optional pointer to a target device node.
2108 * Given a device ID, look up the appropriate implementation-defined
2110 * ID, as per the "iommu-map" and "msi-map" bindings. Either of @target or
2112 * a non-NULL device node pointer, only entries targeting that node will be
2113 * matched; if it points to a NULL value, it will receive the device node of
2127 return -EINVAL; in of_map_id()
2132 return -ENODEV; in of_map_id()
2141 return -EINVAL; in of_map_id()
2148 * Can be overridden by "{iommu,msi}-map-mask" property. in of_map_id()
2155 for ( ; map_len > 0; map_len -= 4 * sizeof(*map), map += 4) { in of_map_id()
2163 pr_err("%pOF: Invalid %s translation - %s-mask (0x%x) ignores id-base (0x%x)\n", in of_map_id()
2166 return -EFAULT; in of_map_id()
2174 return -ENODEV; in of_map_id()
2187 *id_out = masked_id - id_base + out_base; in of_map_id()
2189 …pr_debug("%pOF: %s, using mask %08x, id-base: %08x, out-base: %08x, length: %08x, id: %08x -> %08x… in of_map_id()
2191 id_len, id, masked_id - id_base + out_base); in of_map_id()