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_bus_n_addr_cells(struct device_node *np) in of_bus_n_addr_cells() argument
93 for (; np; np = np->parent) in of_bus_n_addr_cells()
94 if (!of_property_read_u32(np, "#address-cells", &cells)) in of_bus_n_addr_cells()
101 int of_n_addr_cells(struct device_node *np) in of_n_addr_cells() argument
103 if (np->parent) in of_n_addr_cells()
104 np = np->parent; in of_n_addr_cells()
106 return of_bus_n_addr_cells(np); in of_n_addr_cells()
110 int of_bus_n_size_cells(struct device_node *np) in of_bus_n_size_cells() argument
114 for (; np; np = np->parent) in of_bus_n_size_cells()
115 if (!of_property_read_u32(np, "#size-cells", &cells)) in of_bus_n_size_cells()
122 int of_n_size_cells(struct device_node *np) in of_n_size_cells() argument
124 if (np->parent) in of_n_size_cells()
125 np = np->parent; in of_n_size_cells()
127 return of_bus_n_size_cells(np); in of_n_size_cells()
132 int __weak of_node_to_nid(struct device_node *np) in of_node_to_nid() argument
154 struct device_node *np; in __of_phandle_cache_inv_entry() local
161 np = phandle_cache[handle_hash]; in __of_phandle_cache_inv_entry()
162 if (np && handle == np->phandle) in __of_phandle_cache_inv_entry()
168 struct device_node *np; in of_core_init() local
179 for_each_of_allnodes(np) { in of_core_init()
180 __of_attach_node_sysfs(np); in of_core_init()
181 if (np->phandle && !phandle_cache[of_phandle_cache_hash(np->phandle)]) in of_core_init()
182 phandle_cache[of_phandle_cache_hash(np->phandle)] = np; in of_core_init()
191 static struct property *__of_find_property(const struct device_node *np, in __of_find_property() argument
196 if (!np) in __of_find_property()
199 for (pp = np->properties; pp; pp = pp->next) { in __of_find_property()
210 struct property *of_find_property(const struct device_node *np, in of_find_property() argument
218 pp = __of_find_property(np, name, lenp); in of_find_property()
227 struct device_node *np; in __of_find_all_nodes() local
229 np = of_root; in __of_find_all_nodes()
231 np = prev->child; in __of_find_all_nodes()
234 np = prev; in __of_find_all_nodes()
235 while (np->parent && !np->sibling) in __of_find_all_nodes()
236 np = np->parent; in __of_find_all_nodes()
237 np = np->sibling; /* Might be null at the end of the tree */ in __of_find_all_nodes()
239 return np; in __of_find_all_nodes()
252 struct device_node *np; in of_find_all_nodes() local
256 np = __of_find_all_nodes(prev); in of_find_all_nodes()
257 of_node_get(np); in of_find_all_nodes()
260 return np; in of_find_all_nodes()
268 const void *__of_get_property(const struct device_node *np, in __of_get_property() argument
271 struct property *pp = __of_find_property(np, name, lenp); in __of_get_property()
280 const void *of_get_property(const struct device_node *np, const char *name, in of_get_property() argument
283 struct property *pp = of_find_property(np, name, lenp); in of_get_property()
404 struct device_node *np; in of_cpu_node_to_id() local
407 np = of_cpu_device_node_get(cpu); in of_cpu_node_to_id()
408 found = (cpu_node == np); in of_cpu_node_to_id()
409 of_node_put(np); in of_cpu_node_to_id()
443 of_parse_phandle(args.np, "domain-idle-states", index); in of_get_cpu_state_node()
445 of_node_put(args.np); in of_get_cpu_state_node()
662 struct device_node *np; in of_get_parent() local
669 np = of_node_get(node->parent); in of_get_parent()
671 return np; in of_get_parent()
915 struct device_node *np = NULL; in of_find_node_opts_by_path() local
941 np = of_find_node_by_path(pp->value); in of_find_node_opts_by_path()
945 if (!np) in of_find_node_opts_by_path()
952 if (!np) in of_find_node_opts_by_path()
953 np = of_node_get(of_root); in of_find_node_opts_by_path()
954 np = __of_find_node_by_full_path(np, path); in of_find_node_opts_by_path()
956 return np; in of_find_node_opts_by_path()
974 struct device_node *np; in of_find_node_by_name() local
978 for_each_of_allnodes_from(from, np) in of_find_node_by_name()
979 if (of_node_name_eq(np, name) && of_node_get(np)) in of_find_node_by_name()
983 return np; in of_find_node_by_name()
1002 struct device_node *np; in of_find_node_by_type() local
1006 for_each_of_allnodes_from(from, np) in of_find_node_by_type()
1007 if (__of_node_is_type(np, type) && of_node_get(np)) in of_find_node_by_type()
1011 return np; in of_find_node_by_type()
1032 struct device_node *np; in of_find_compatible_node() local
1036 for_each_of_allnodes_from(from, np) in of_find_compatible_node()
1037 if (__of_device_is_compatible(np, compatible, type, NULL) && in of_find_compatible_node()
1038 of_node_get(np)) in of_find_compatible_node()
1042 return np; in of_find_compatible_node()
1061 struct device_node *np; in of_find_node_with_property() local
1066 for_each_of_allnodes_from(from, np) { in of_find_node_with_property()
1067 for (pp = np->properties; pp; pp = pp->next) { in of_find_node_with_property()
1069 of_node_get(np); in of_find_node_with_property()
1077 return np; in of_find_node_with_property()
1140 struct device_node *np; in of_find_matching_node_and_match() local
1148 for_each_of_allnodes_from(from, np) { in of_find_matching_node_and_match()
1149 m = __of_match_node(matches, np); in of_find_matching_node_and_match()
1150 if (m && of_node_get(np)) { in of_find_matching_node_and_match()
1158 return np; in of_find_matching_node_and_match()
1198 struct device_node *np = NULL; in of_find_node_by_phandle() local
1211 np = phandle_cache[handle_hash]; in of_find_node_by_phandle()
1213 if (!np) { in of_find_node_by_phandle()
1214 for_each_of_allnodes(np) in of_find_node_by_phandle()
1215 if (np->phandle == handle && in of_find_node_by_phandle()
1216 !of_node_check_flag(np, OF_DETACHED)) { in of_find_node_by_phandle()
1217 phandle_cache[handle_hash] = np; in of_find_node_by_phandle()
1222 of_node_get(np); in of_find_node_by_phandle()
1224 return np; in of_find_node_by_phandle()
1231 printk("%s %pOF", msg, args->np); in of_print_phandle_args()
1241 const struct device_node *np, in of_phandle_iterator_init() argument
1258 list = of_get_property(np, list_name, &size); in of_phandle_iterator_init()
1264 it->parent = np; in of_phandle_iterator_init()
1375 static int __of_parse_phandle_with_args(const struct device_node *np, in __of_parse_phandle_with_args() argument
1385 of_for_each_phandle(&it, rc, np, list_name, cells_name, cell_count) { in __of_parse_phandle_with_args()
1403 out_args->np = it.node; in __of_parse_phandle_with_args()
1437 struct device_node *of_parse_phandle(const struct device_node *np, in of_parse_phandle() argument
1445 if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0, in of_parse_phandle()
1449 return args.np; in of_parse_phandle()
1485 int of_parse_phandle_with_args(const struct device_node *np, const char *list_name, in of_parse_phandle_with_args() argument
1498 return __of_parse_phandle_with_args(np, list_name, cells_name, in of_parse_phandle_with_args()
1545 int of_parse_phandle_with_args_map(const struct device_node *np, in of_parse_phandle_with_args_map() argument
1581 ret = __of_parse_phandle_with_args(np, list_name, cells_name, -1, index, in of_parse_phandle_with_args_map()
1587 cur = out_args->np; in of_parse_phandle_with_args_map()
1670 out_args->np = new; in of_parse_phandle_with_args_map()
1717 int of_parse_phandle_with_fixed_args(const struct device_node *np, in of_parse_phandle_with_fixed_args() argument
1723 return __of_parse_phandle_with_args(np, list_name, NULL, cell_count, in of_parse_phandle_with_fixed_args()
1743 int of_count_phandle_with_args(const struct device_node *np, const char *list_name, in of_count_phandle_with_args() argument
1759 list = of_get_property(np, list_name, &size); in of_count_phandle_with_args()
1766 rc = of_phandle_iterator_init(&it, np, list_name, cells_name, -1); in of_count_phandle_with_args()
1783 int __of_add_property(struct device_node *np, struct property *prop) in __of_add_property() argument
1788 next = &np->properties; in __of_add_property()
1804 int of_add_property(struct device_node *np, struct property *prop) in of_add_property() argument
1812 rc = __of_add_property(np, prop); in of_add_property()
1816 __of_add_property_sysfs(np, prop); in of_add_property()
1821 of_property_notify(OF_RECONFIG_ADD_PROPERTY, np, prop, NULL); in of_add_property()
1827 int __of_remove_property(struct device_node *np, struct property *prop) in __of_remove_property() argument
1831 for (next = &np->properties; *next; next = &(*next)->next) { in __of_remove_property()
1840 prop->next = np->deadprops; in __of_remove_property()
1841 np->deadprops = prop; in __of_remove_property()
1854 int of_remove_property(struct device_node *np, struct property *prop) in of_remove_property() argument
1865 rc = __of_remove_property(np, prop); in of_remove_property()
1869 __of_remove_property_sysfs(np, prop); in of_remove_property()
1874 of_property_notify(OF_RECONFIG_REMOVE_PROPERTY, np, prop, NULL); in of_remove_property()
1880 int __of_update_property(struct device_node *np, struct property *newprop, in __of_update_property() argument
1885 for (next = &np->properties; *next; next = &(*next)->next) { in __of_update_property()
1895 oldprop->next = np->deadprops; in __of_update_property()
1896 np->deadprops = oldprop; in __of_update_property()
1915 int of_update_property(struct device_node *np, struct property *newprop) in of_update_property() argument
1927 rc = __of_update_property(np, newprop, &oldprop); in of_update_property()
1931 __of_update_property_sysfs(np, newprop, oldprop); in of_update_property()
1936 of_property_notify(OF_RECONFIG_UPDATE_PROPERTY, np, newprop, oldprop); in of_update_property()
1941 static void of_alias_add(struct alias_prop *ap, struct device_node *np, in of_alias_add() argument
1944 ap->np = np; in of_alias_add()
1950 ap->alias, ap->stem, ap->id, np); in of_alias_add()
1991 struct device_node *np; in of_alias_scan() local
2001 np = of_find_node_by_path(pp->value); in of_alias_scan()
2002 if (!np) in of_alias_scan()
2020 of_alias_add(ap, np, id, start, len); in of_alias_scan()
2032 int of_alias_get_id(struct device_node *np, const char *stem) in of_alias_get_id() argument
2042 if (np == app->np) { in of_alias_get_id()
2088 if (of_match_node(matches, app->np)) { in of_alias_get_alias_list()
2163 struct device_node *of_find_next_cache_node(const struct device_node *np) in of_find_next_cache_node() argument
2167 cache_node = of_parse_phandle(np, "l2-cache", 0); in of_find_next_cache_node()
2169 cache_node = of_parse_phandle(np, "next-level-cache", 0); in of_find_next_cache_node()
2177 if (IS_ENABLED(CONFIG_PPC_PMAC) && of_node_is_type(np, "cpu")) in of_find_next_cache_node()
2178 for_each_child_of_node(np, child) in of_find_next_cache_node()
2197 struct device_node *prev = NULL, *np = of_cpu_device_node_get(cpu); in of_find_last_cache_level() local
2199 while (np) { in of_find_last_cache_level()
2200 prev = np; in of_find_last_cache_level()
2201 of_node_put(np); in of_find_last_cache_level()
2202 np = of_find_next_cache_node(np); in of_find_last_cache_level()
2229 int of_map_id(struct device_node *np, u32 id, in of_map_id() argument
2237 if (!np || !map_name || (!target && !id_out)) in of_map_id()
2240 map = of_get_property(np, map_name, &map_len); in of_map_id()
2250 pr_err("%pOF: Error: Bad %s length: %d\n", np, in of_map_id()
2263 of_property_read_u32(np, map_mask_name, &map_mask); in of_map_id()
2275 np, map_name, map_name, in of_map_id()
2301 np, map_name, map_mask, id_base, out_base, in of_map_id()
2306 pr_info("%pOF: no %s translation for id 0x%x on %pOF\n", np, map_name, in of_map_id()