Lines Matching full:np

59 bool of_node_name_eq(const struct device_node *np, const char *name)  in of_node_name_eq()  argument
64 if (!np) in of_node_name_eq()
67 node_name = kbasename(np->full_name); in of_node_name_eq()
74 bool of_node_name_prefix(const struct device_node *np, const char *prefix) in of_node_name_prefix() argument
76 if (!np) in of_node_name_prefix()
79 return strncmp(kbasename(np->full_name), prefix, strlen(prefix)) == 0; in of_node_name_prefix()
83 static bool __of_node_is_type(const struct device_node *np, const char *type) in __of_node_is_type() argument
85 const char *match = __of_get_property(np, "device_type", NULL); in __of_node_is_type()
87 return np && match && type && !strcmp(match, type); in __of_node_is_type()
95 int of_bus_n_addr_cells(struct device_node *np) in of_bus_n_addr_cells() argument
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()
108 "Missing '#address-cells' in %pOF\n", np); in of_bus_n_addr_cells()
113 int of_n_addr_cells(struct device_node *np) in of_n_addr_cells() argument
115 if (np->parent) in of_n_addr_cells()
116 np = np->parent; in of_n_addr_cells()
118 return of_bus_n_addr_cells(np); in of_n_addr_cells()
122 int of_bus_n_size_cells(struct device_node *np) in of_bus_n_size_cells() argument
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()
135 "Missing '#size-cells' in %pOF\n", np); in of_bus_n_size_cells()
140 int of_n_size_cells(struct device_node *np) in of_n_size_cells() argument
142 if (np->parent) in of_n_size_cells()
143 np = np->parent; in of_n_size_cells()
145 return of_bus_n_size_cells(np); in of_n_size_cells()
150 int __weak of_node_to_nid(struct device_node *np) in of_node_to_nid() argument
172 struct device_node *np; in __of_phandle_cache_inv_entry() local
179 np = phandle_cache[handle_hash]; in __of_phandle_cache_inv_entry()
180 if (np && handle == np->phandle) in __of_phandle_cache_inv_entry()
186 struct device_node *np; in of_core_init() local
198 for_each_of_allnodes(np) { in of_core_init()
199 __of_attach_node_sysfs(np); in of_core_init()
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()
210 static struct property *__of_find_property(const struct device_node *np, in __of_find_property() argument
215 if (!np) in __of_find_property()
218 for (pp = np->properties; pp; pp = pp->next) { in __of_find_property()
229 struct property *of_find_property(const struct device_node *np, in of_find_property() argument
237 pp = __of_find_property(np, name, lenp); in of_find_property()
246 struct device_node *np; in __of_find_all_nodes() local
248 np = of_root; in __of_find_all_nodes()
250 np = prev->child; in __of_find_all_nodes()
253 np = prev; 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()
258 return np; in __of_find_all_nodes()
271 struct device_node *np; in of_find_all_nodes() local
275 np = __of_find_all_nodes(prev); in of_find_all_nodes()
276 of_node_get(np); in of_find_all_nodes()
279 return np; in of_find_all_nodes()
287 const void *__of_get_property(const struct device_node *np, in __of_get_property() argument
290 const struct property *pp = __of_find_property(np, name, lenp); in __of_get_property()
299 const void *of_get_property(const struct device_node *np, const char *name, in of_get_property() argument
302 const struct property *pp = of_find_property(np, name, lenp); in of_get_property()
569 struct device_node *np; in of_get_parent() local
576 np = of_node_get(node->parent); in of_get_parent()
578 return np; in of_get_parent()
883 struct device_node *np = NULL; in of_find_node_opts_by_path() local
909 np = of_find_node_by_path(pp->value); in of_find_node_opts_by_path()
913 if (!np) in of_find_node_opts_by_path()
920 if (!np) in of_find_node_opts_by_path()
921 np = of_node_get(of_root); in of_find_node_opts_by_path()
922 np = __of_find_node_by_full_path(np, path); in of_find_node_opts_by_path()
924 return np; in of_find_node_opts_by_path()
942 struct device_node *np; in of_find_node_by_name() local
946 for_each_of_allnodes_from(from, np) in of_find_node_by_name()
947 if (of_node_name_eq(np, name) && of_node_get(np)) in of_find_node_by_name()
951 return np; in of_find_node_by_name()
970 struct device_node *np; in of_find_node_by_type() local
974 for_each_of_allnodes_from(from, np) in of_find_node_by_type()
975 if (__of_node_is_type(np, type) && of_node_get(np)) in of_find_node_by_type()
979 return np; in of_find_node_by_type()
1000 struct device_node *np; in of_find_compatible_node() local
1004 for_each_of_allnodes_from(from, np) in of_find_compatible_node()
1005 if (__of_device_is_compatible(np, compatible, type, NULL) && in of_find_compatible_node()
1006 of_node_get(np)) in of_find_compatible_node()
1010 return np; in of_find_compatible_node()
1029 struct device_node *np; in of_find_node_with_property() local
1033 for_each_of_allnodes_from(from, np) { in of_find_node_with_property()
1034 if (__of_find_property(np, prop_name, NULL)) { in of_find_node_with_property()
1035 of_node_get(np); in of_find_node_with_property()
1041 return np; in of_find_node_with_property()
1104 struct device_node *np; in of_find_matching_node_and_match() local
1112 for_each_of_allnodes_from(from, np) { in of_find_matching_node_and_match()
1113 m = __of_match_node(matches, np); in of_find_matching_node_and_match()
1114 if (m && of_node_get(np)) { in of_find_matching_node_and_match()
1122 return np; in of_find_matching_node_and_match()
1166 struct device_node *np = NULL; in of_find_node_by_phandle() local
1179 np = phandle_cache[handle_hash]; in of_find_node_by_phandle()
1181 if (!np) { in of_find_node_by_phandle()
1182 for_each_of_allnodes(np) in of_find_node_by_phandle()
1183 if (np->phandle == handle && in of_find_node_by_phandle()
1184 !of_node_check_flag(np, OF_DETACHED)) { in of_find_node_by_phandle()
1185 phandle_cache[handle_hash] = np; in of_find_node_by_phandle()
1190 of_node_get(np); in of_find_node_by_phandle()
1192 return np; in of_find_node_by_phandle()
1199 printk("%s %pOF", msg, args->np); in of_print_phandle_args()
1209 const struct device_node *np, in of_phandle_iterator_init() argument
1226 list = of_get_property(np, list_name, &size); in of_phandle_iterator_init()
1232 it->parent = np; in of_phandle_iterator_init()
1343 int __of_parse_phandle_with_args(const struct device_node *np, in __of_parse_phandle_with_args() argument
1356 of_for_each_phandle(&it, rc, np, list_name, cells_name, cell_count) { in __of_parse_phandle_with_args()
1374 out_args->np = it.node; in __of_parse_phandle_with_args()
1401 * @np: pointer to a device tree node containing a list
1413 * Caller is responsible to call of_node_put() on the returned out_args->np
1441 int of_parse_phandle_with_args_map(const struct device_node *np, in of_parse_phandle_with_args_map() argument
1465 ret = __of_parse_phandle_with_args(np, list_name, cells_name, -1, index, in of_parse_phandle_with_args_map()
1471 cur = out_args->np; in of_parse_phandle_with_args_map()
1558 out_args->np = new; in of_parse_phandle_with_args_map()
1572 * @np: pointer to a device tree node containing a list
1585 int of_count_phandle_with_args(const struct device_node *np, const char *list_name, in of_count_phandle_with_args() argument
1601 list = of_get_property(np, list_name, &size); in of_count_phandle_with_args()
1608 rc = of_phandle_iterator_init(&it, np, list_name, cells_name, -1); in of_count_phandle_with_args()
1638 * @np: Caller's Device Node
1641 int __of_add_property(struct device_node *np, struct property *prop) in __of_add_property() argument
1649 __of_remove_property_from_list(&np->deadprops, prop); in __of_add_property()
1652 next = &np->properties; in __of_add_property()
1668 __of_add_property_sysfs(np, prop); in __of_add_property()
1674 * @np: Caller's Device Node
1677 int of_add_property(struct device_node *np, struct property *prop) in of_add_property() argument
1682 rc = __of_add_property(np, prop); in of_add_property()
1686 of_property_notify(OF_RECONFIG_ADD_PROPERTY, np, prop, NULL); in of_add_property()
1692 int __of_remove_property(struct device_node *np, struct property *prop) in __of_remove_property() argument
1699 if (__of_remove_property_from_list(&np->properties, prop)) { in __of_remove_property()
1701 prop->next = np->deadprops; in __of_remove_property()
1702 np->deadprops = prop; in __of_remove_property()
1710 __of_remove_property_sysfs(np, prop); in __of_remove_property()
1716 * @np: Caller's Device Node
1724 int of_remove_property(struct device_node *np, struct property *prop) in of_remove_property() argument
1732 rc = __of_remove_property(np, prop); in of_remove_property()
1736 of_property_notify(OF_RECONFIG_REMOVE_PROPERTY, np, prop, NULL); in of_remove_property()
1742 int __of_update_property(struct device_node *np, struct property *newprop, in __of_update_property() argument
1750 __of_remove_property_from_list(&np->deadprops, newprop); in __of_update_property()
1752 for (next = &np->properties; *next; next = &(*next)->next) { in __of_update_property()
1762 oldprop->next = np->deadprops; in __of_update_property()
1763 np->deadprops = oldprop; in __of_update_property()
1772 __of_update_property_sysfs(np, newprop, oldprop); in __of_update_property()
1786 int of_update_property(struct device_node *np, struct property *newprop) in of_update_property() argument
1795 rc = __of_update_property(np, newprop, &oldprop); in of_update_property()
1799 of_property_notify(OF_RECONFIG_UPDATE_PROPERTY, np, newprop, oldprop); in of_update_property()
1804 static void of_alias_add(struct alias_prop *ap, struct device_node *np, in of_alias_add() argument
1807 ap->np = np; in of_alias_add()
1812 ap->alias, ap->stem, ap->id, np); in of_alias_add()
1853 struct device_node *np; in of_alias_scan() local
1863 np = of_find_node_by_path(pp->value); in of_alias_scan()
1864 if (!np) in of_alias_scan()
1882 of_alias_add(ap, np, id, start, len); in of_alias_scan()
1888 * @np: Pointer to the given device_node
1896 int of_alias_get_id(const struct device_node *np, const char *stem) in of_alias_get_id() argument
1906 if (np == app->np) { in of_alias_get_id()
1969 * @np: node of type "cpu" or "cache"
1973 * to np.
1975 struct device_node *of_find_next_cache_node(const struct device_node *np) in of_find_next_cache_node() argument
1979 cache_node = of_parse_phandle(np, "l2-cache", 0); in of_find_next_cache_node()
1981 cache_node = of_parse_phandle(np, "next-level-cache", 0); in of_find_next_cache_node()
1989 if (IS_ENABLED(CONFIG_PPC_PMAC) && of_node_is_type(np, "cpu")) in of_find_next_cache_node()
1990 for_each_child_of_node(np, child) in of_find_next_cache_node()
2009 struct device_node *prev = NULL, *np = of_cpu_device_node_get(cpu); in of_find_last_cache_level() local
2011 while (np) { in of_find_last_cache_level()
2013 prev = np; in of_find_last_cache_level()
2014 np = of_find_next_cache_node(np); in of_find_last_cache_level()
2025 * @np: root complex device node.
2042 int of_map_id(const struct device_node *np, u32 id, in of_map_id() argument
2050 if (!np || !map_name || (!target && !id_out)) in of_map_id()
2053 map = of_get_property(np, map_name, &map_len); in of_map_id()
2063 pr_err("%pOF: Error: Bad %s length: %d\n", np, in of_map_id()
2076 of_property_read_u32(np, map_mask_name, &map_mask); in of_map_id()
2088 np, map_name, map_name, in of_map_id()
2114 np, map_name, map_mask, id_base, out_base, in of_map_id()
2119 pr_info("%pOF: no %s translation for id 0x%x on %pOF\n", np, map_name, in of_map_id()