Lines Matching refs:np
58 bool of_node_name_eq(const struct device_node *np, const char *name) in of_node_name_eq() argument
63 if (!np) in of_node_name_eq()
66 node_name = kbasename(np->full_name); in of_node_name_eq()
73 bool of_node_name_prefix(const struct device_node *np, const char *prefix) in of_node_name_prefix() argument
75 if (!np) in of_node_name_prefix()
78 return strncmp(kbasename(np->full_name), prefix, strlen(prefix)) == 0; in of_node_name_prefix()
82 static bool __of_node_is_type(const struct device_node *np, const char *type) in __of_node_is_type() argument
84 const char *match = __of_get_property(np, "device_type", NULL); in __of_node_is_type()
86 return np && match && type && !strcmp(match, type); in __of_node_is_type()
89 int of_n_addr_cells(struct device_node *np) in of_n_addr_cells() argument
94 if (np->parent) in of_n_addr_cells()
95 np = np->parent; in of_n_addr_cells()
96 if (!of_property_read_u32(np, "#address-cells", &cells)) in of_n_addr_cells()
98 } while (np->parent); in of_n_addr_cells()
104 int of_n_size_cells(struct device_node *np) in of_n_size_cells() argument
109 if (np->parent) in of_n_size_cells()
110 np = np->parent; in of_n_size_cells()
111 if (!of_property_read_u32(np, "#size-cells", &cells)) in of_n_size_cells()
113 } while (np->parent); in of_n_size_cells()
120 int __weak of_node_to_nid(struct device_node *np) in of_node_to_nid() argument
178 struct device_node *np; in __of_free_phandle_cache_entry() local
186 np = phandle_cache[masked_handle]; in __of_free_phandle_cache_entry()
187 if (np && handle == np->phandle) { in __of_free_phandle_cache_entry()
188 of_node_put(np); in __of_free_phandle_cache_entry()
198 struct device_node *np; in of_populate_phandle_cache() local
205 for_each_of_allnodes(np) in of_populate_phandle_cache()
206 if (np->phandle && np->phandle != OF_PHANDLE_ILLEGAL) in of_populate_phandle_cache()
220 for_each_of_allnodes(np) in of_populate_phandle_cache()
221 if (np->phandle && np->phandle != OF_PHANDLE_ILLEGAL) { in of_populate_phandle_cache()
222 of_node_get(np); in of_populate_phandle_cache()
223 phandle_cache[np->phandle & phandle_cache_mask] = np; in of_populate_phandle_cache()
232 struct device_node *np; in of_core_init() local
244 for_each_of_allnodes(np) in of_core_init()
245 __of_attach_node_sysfs(np); in of_core_init()
253 static struct property *__of_find_property(const struct device_node *np, in __of_find_property() argument
258 if (!np) in __of_find_property()
261 for (pp = np->properties; pp; pp = pp->next) { in __of_find_property()
272 struct property *of_find_property(const struct device_node *np, in of_find_property() argument
280 pp = __of_find_property(np, name, lenp); in of_find_property()
289 struct device_node *np; in __of_find_all_nodes() local
291 np = of_root; in __of_find_all_nodes()
293 np = prev->child; in __of_find_all_nodes()
296 np = prev; in __of_find_all_nodes()
297 while (np->parent && !np->sibling) in __of_find_all_nodes()
298 np = np->parent; in __of_find_all_nodes()
299 np = np->sibling; /* Might be null at the end of the tree */ in __of_find_all_nodes()
301 return np; in __of_find_all_nodes()
314 struct device_node *np; in of_find_all_nodes() local
318 np = __of_find_all_nodes(prev); in of_find_all_nodes()
319 of_node_get(np); in of_find_all_nodes()
322 return np; in of_find_all_nodes()
330 const void *__of_get_property(const struct device_node *np, in __of_get_property() argument
333 struct property *pp = __of_find_property(np, name, lenp); in __of_get_property()
342 const void *of_get_property(const struct device_node *np, const char *name, in of_get_property() argument
345 struct property *pp = of_find_property(np, name, lenp); in of_get_property()
466 struct device_node *np; in of_cpu_node_to_id() local
469 np = of_cpu_device_node_get(cpu); in of_cpu_node_to_id()
470 found = (cpu_node == np); in of_cpu_node_to_id()
471 of_node_put(np); in of_cpu_node_to_id()
688 struct device_node *np; in of_get_parent() local
695 np = of_node_get(node->parent); in of_get_parent()
697 return np; in of_get_parent()
941 struct device_node *np = NULL; in of_find_node_opts_by_path() local
967 np = of_find_node_by_path(pp->value); in of_find_node_opts_by_path()
971 if (!np) in of_find_node_opts_by_path()
978 if (!np) in of_find_node_opts_by_path()
979 np = of_node_get(of_root); in of_find_node_opts_by_path()
980 np = __of_find_node_by_full_path(np, path); in of_find_node_opts_by_path()
982 return np; in of_find_node_opts_by_path()
1000 struct device_node *np; in of_find_node_by_name() local
1004 for_each_of_allnodes_from(from, np) in of_find_node_by_name()
1005 if (of_node_name_eq(np, name) && of_node_get(np)) in of_find_node_by_name()
1009 return np; in of_find_node_by_name()
1028 struct device_node *np; in of_find_node_by_type() local
1032 for_each_of_allnodes_from(from, np) in of_find_node_by_type()
1033 if (__of_node_is_type(np, type) && of_node_get(np)) in of_find_node_by_type()
1037 return np; in of_find_node_by_type()
1058 struct device_node *np; in of_find_compatible_node() local
1062 for_each_of_allnodes_from(from, np) in of_find_compatible_node()
1063 if (__of_device_is_compatible(np, compatible, type, NULL) && in of_find_compatible_node()
1064 of_node_get(np)) in of_find_compatible_node()
1068 return np; in of_find_compatible_node()
1087 struct device_node *np; in of_find_node_with_property() local
1092 for_each_of_allnodes_from(from, np) { in of_find_node_with_property()
1093 for (pp = np->properties; pp; pp = pp->next) { in of_find_node_with_property()
1095 of_node_get(np); in of_find_node_with_property()
1103 return np; in of_find_node_with_property()
1166 struct device_node *np; in of_find_matching_node_and_match() local
1174 for_each_of_allnodes_from(from, np) { in of_find_matching_node_and_match()
1175 m = __of_match_node(matches, np); in of_find_matching_node_and_match()
1176 if (m && of_node_get(np)) { in of_find_matching_node_and_match()
1184 return np; in of_find_matching_node_and_match()
1224 struct device_node *np = NULL; in of_find_node_by_phandle() local
1238 np = phandle_cache[masked_handle]; in of_find_node_by_phandle()
1239 if (np && of_node_check_flag(np, OF_DETACHED)) { in of_find_node_by_phandle()
1241 of_node_put(np); in of_find_node_by_phandle()
1243 np = NULL; in of_find_node_by_phandle()
1247 if (!np) { in of_find_node_by_phandle()
1248 for_each_of_allnodes(np) in of_find_node_by_phandle()
1249 if (np->phandle == handle && in of_find_node_by_phandle()
1250 !of_node_check_flag(np, OF_DETACHED)) { in of_find_node_by_phandle()
1253 of_node_get(np); in of_find_node_by_phandle()
1254 phandle_cache[masked_handle] = np; in of_find_node_by_phandle()
1260 of_node_get(np); in of_find_node_by_phandle()
1262 return np; in of_find_node_by_phandle()
1269 printk("%s %pOF", msg, args->np); in of_print_phandle_args()
1279 const struct device_node *np, in of_phandle_iterator_init() argument
1296 list = of_get_property(np, list_name, &size); in of_phandle_iterator_init()
1302 it->parent = np; in of_phandle_iterator_init()
1408 static int __of_parse_phandle_with_args(const struct device_node *np, in __of_parse_phandle_with_args() argument
1418 of_for_each_phandle(&it, rc, np, list_name, cells_name, cell_count) { in __of_parse_phandle_with_args()
1436 out_args->np = it.node; in __of_parse_phandle_with_args()
1470 struct device_node *of_parse_phandle(const struct device_node *np, in of_parse_phandle() argument
1478 if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0, in of_parse_phandle()
1482 return args.np; in of_parse_phandle()
1518 int of_parse_phandle_with_args(const struct device_node *np, const char *list_name, in of_parse_phandle_with_args() argument
1531 return __of_parse_phandle_with_args(np, list_name, cells_name, in of_parse_phandle_with_args()
1578 int of_parse_phandle_with_args_map(const struct device_node *np, in of_parse_phandle_with_args_map() argument
1614 ret = __of_parse_phandle_with_args(np, list_name, cells_name, -1, index, in of_parse_phandle_with_args_map()
1620 cur = out_args->np; in of_parse_phandle_with_args_map()
1703 out_args->np = new; in of_parse_phandle_with_args_map()
1750 int of_parse_phandle_with_fixed_args(const struct device_node *np, in of_parse_phandle_with_fixed_args() argument
1756 return __of_parse_phandle_with_args(np, list_name, NULL, cell_count, in of_parse_phandle_with_fixed_args()
1776 int of_count_phandle_with_args(const struct device_node *np, const char *list_name, in of_count_phandle_with_args() argument
1792 list = of_get_property(np, list_name, &size); in of_count_phandle_with_args()
1799 rc = of_phandle_iterator_init(&it, np, list_name, cells_name, -1); in of_count_phandle_with_args()
1816 int __of_add_property(struct device_node *np, struct property *prop) in __of_add_property() argument
1821 next = &np->properties; in __of_add_property()
1837 int of_add_property(struct device_node *np, struct property *prop) in of_add_property() argument
1845 rc = __of_add_property(np, prop); in of_add_property()
1849 __of_add_property_sysfs(np, prop); in of_add_property()
1854 of_property_notify(OF_RECONFIG_ADD_PROPERTY, np, prop, NULL); in of_add_property()
1859 int __of_remove_property(struct device_node *np, struct property *prop) in __of_remove_property() argument
1863 for (next = &np->properties; *next; next = &(*next)->next) { in __of_remove_property()
1872 prop->next = np->deadprops; in __of_remove_property()
1873 np->deadprops = prop; in __of_remove_property()
1886 int of_remove_property(struct device_node *np, struct property *prop) in of_remove_property() argument
1897 rc = __of_remove_property(np, prop); in of_remove_property()
1901 __of_remove_property_sysfs(np, prop); in of_remove_property()
1906 of_property_notify(OF_RECONFIG_REMOVE_PROPERTY, np, prop, NULL); in of_remove_property()
1911 int __of_update_property(struct device_node *np, struct property *newprop, in __of_update_property() argument
1916 for (next = &np->properties; *next; next = &(*next)->next) { in __of_update_property()
1926 oldprop->next = np->deadprops; in __of_update_property()
1927 np->deadprops = oldprop; in __of_update_property()
1946 int of_update_property(struct device_node *np, struct property *newprop) in of_update_property() argument
1958 rc = __of_update_property(np, newprop, &oldprop); in of_update_property()
1962 __of_update_property_sysfs(np, newprop, oldprop); in of_update_property()
1967 of_property_notify(OF_RECONFIG_UPDATE_PROPERTY, np, newprop, oldprop); in of_update_property()
1972 static void of_alias_add(struct alias_prop *ap, struct device_node *np, in of_alias_add() argument
1975 ap->np = np; in of_alias_add()
1981 ap->alias, ap->stem, ap->id, np); in of_alias_add()
2022 struct device_node *np; in of_alias_scan() local
2032 np = of_find_node_by_path(pp->value); in of_alias_scan()
2033 if (!np) in of_alias_scan()
2051 of_alias_add(ap, np, id, start, len); in of_alias_scan()
2063 int of_alias_get_id(struct device_node *np, const char *stem) in of_alias_get_id() argument
2073 if (np == app->np) { in of_alias_get_id()
2119 if (of_match_node(matches, app->np)) { in of_alias_get_alias_list()
2194 struct device_node *of_find_next_cache_node(const struct device_node *np) in of_find_next_cache_node() argument
2198 cache_node = of_parse_phandle(np, "l2-cache", 0); in of_find_next_cache_node()
2200 cache_node = of_parse_phandle(np, "next-level-cache", 0); in of_find_next_cache_node()
2208 if (IS_ENABLED(CONFIG_PPC_PMAC) && of_node_is_type(np, "cpu")) in of_find_next_cache_node()
2209 for_each_child_of_node(np, child) in of_find_next_cache_node()
2228 struct device_node *prev = NULL, *np = of_cpu_device_node_get(cpu); in of_find_last_cache_level() local
2230 while (np) { in of_find_last_cache_level()
2231 prev = np; in of_find_last_cache_level()
2232 of_node_put(np); in of_find_last_cache_level()
2233 np = of_find_next_cache_node(np); in of_find_last_cache_level()
2260 int of_map_rid(struct device_node *np, u32 rid, in of_map_rid() argument
2268 if (!np || !map_name || (!target && !id_out)) in of_map_rid()
2271 map = of_get_property(np, map_name, &map_len); in of_map_rid()
2281 pr_err("%pOF: Error: Bad %s length: %d\n", np, in of_map_rid()
2294 of_property_read_u32(np, map_mask_name, &map_mask); in of_map_rid()
2306 np, map_name, map_name, in of_map_rid()
2332 np, map_name, map_mask, rid_base, out_base, in of_map_rid()
2337 pr_info("%pOF: no %s translation for rid 0x%x on %pOF\n", np, map_name, in of_map_rid()