Lines Matching refs:np
57 bool of_node_name_eq(const struct device_node *np, const char *name) in of_node_name_eq() argument
62 if (!np) in of_node_name_eq()
65 node_name = kbasename(np->full_name); in of_node_name_eq()
71 bool of_node_name_prefix(const struct device_node *np, const char *prefix) in of_node_name_prefix() argument
73 if (!np) in of_node_name_prefix()
76 return strncmp(kbasename(np->full_name), prefix, strlen(prefix)) == 0; in of_node_name_prefix()
79 int of_n_addr_cells(struct device_node *np) in of_n_addr_cells() argument
84 if (np->parent) in of_n_addr_cells()
85 np = np->parent; in of_n_addr_cells()
86 if (!of_property_read_u32(np, "#address-cells", &cells)) in of_n_addr_cells()
88 } while (np->parent); in of_n_addr_cells()
94 int of_n_size_cells(struct device_node *np) in of_n_size_cells() argument
99 if (np->parent) in of_n_size_cells()
100 np = np->parent; in of_n_size_cells()
101 if (!of_property_read_u32(np, "#size-cells", &cells)) in of_n_size_cells()
103 } while (np->parent); in of_n_size_cells()
110 int __weak of_node_to_nid(struct device_node *np) in of_node_to_nid() argument
131 struct device_node *np; in of_populate_phandle_cache() local
139 for_each_of_allnodes(np) in of_populate_phandle_cache()
140 if (np->phandle && np->phandle != OF_PHANDLE_ILLEGAL) in of_populate_phandle_cache()
154 for_each_of_allnodes(np) in of_populate_phandle_cache()
155 if (np->phandle && np->phandle != OF_PHANDLE_ILLEGAL) in of_populate_phandle_cache()
156 phandle_cache[np->phandle & phandle_cache_mask] = np; in of_populate_phandle_cache()
181 struct device_node *np; in of_core_init() local
193 for_each_of_allnodes(np) in of_core_init()
194 __of_attach_node_sysfs(np); in of_core_init()
202 static struct property *__of_find_property(const struct device_node *np, in __of_find_property() argument
207 if (!np) in __of_find_property()
210 for (pp = np->properties; pp; pp = pp->next) { in __of_find_property()
221 struct property *of_find_property(const struct device_node *np, in of_find_property() argument
229 pp = __of_find_property(np, name, lenp); in of_find_property()
238 struct device_node *np; in __of_find_all_nodes() local
240 np = of_root; in __of_find_all_nodes()
242 np = prev->child; in __of_find_all_nodes()
245 np = prev; in __of_find_all_nodes()
246 while (np->parent && !np->sibling) in __of_find_all_nodes()
247 np = np->parent; in __of_find_all_nodes()
248 np = np->sibling; /* Might be null at the end of the tree */ in __of_find_all_nodes()
250 return np; in __of_find_all_nodes()
263 struct device_node *np; in of_find_all_nodes() local
267 np = __of_find_all_nodes(prev); in of_find_all_nodes()
268 of_node_get(np); in of_find_all_nodes()
271 return np; in of_find_all_nodes()
279 const void *__of_get_property(const struct device_node *np, in __of_get_property() argument
282 struct property *pp = __of_find_property(np, name, lenp); in __of_get_property()
291 const void *of_get_property(const struct device_node *np, const char *name, in of_get_property() argument
294 struct property *pp = of_find_property(np, name, lenp); in of_get_property()
413 struct device_node *np; in of_cpu_node_to_id() local
416 np = of_cpu_device_node_get(cpu); in of_cpu_node_to_id()
417 found = (cpu_node == np); in of_cpu_node_to_id()
418 of_node_put(np); in of_cpu_node_to_id()
635 struct device_node *np; in of_get_parent() local
642 np = of_node_get(node->parent); in of_get_parent()
644 return np; in of_get_parent()
851 struct device_node *np = NULL; in of_find_node_opts_by_path() local
877 np = of_find_node_by_path(pp->value); in of_find_node_opts_by_path()
881 if (!np) in of_find_node_opts_by_path()
888 if (!np) in of_find_node_opts_by_path()
889 np = of_node_get(of_root); in of_find_node_opts_by_path()
890 np = __of_find_node_by_full_path(np, path); in of_find_node_opts_by_path()
892 return np; in of_find_node_opts_by_path()
910 struct device_node *np; in of_find_node_by_name() local
914 for_each_of_allnodes_from(from, np) in of_find_node_by_name()
915 if (np->name && (of_node_cmp(np->name, name) == 0) in of_find_node_by_name()
916 && of_node_get(np)) in of_find_node_by_name()
920 return np; in of_find_node_by_name()
939 struct device_node *np; in of_find_node_by_type() local
943 for_each_of_allnodes_from(from, np) in of_find_node_by_type()
944 if (np->type && (of_node_cmp(np->type, type) == 0) in of_find_node_by_type()
945 && of_node_get(np)) in of_find_node_by_type()
949 return np; in of_find_node_by_type()
970 struct device_node *np; in of_find_compatible_node() local
974 for_each_of_allnodes_from(from, np) in of_find_compatible_node()
975 if (__of_device_is_compatible(np, compatible, type, NULL) && in of_find_compatible_node()
976 of_node_get(np)) in of_find_compatible_node()
980 return np; in of_find_compatible_node()
999 struct device_node *np; in of_find_node_with_property() local
1004 for_each_of_allnodes_from(from, np) { in of_find_node_with_property()
1005 for (pp = np->properties; pp; pp = pp->next) { in of_find_node_with_property()
1007 of_node_get(np); in of_find_node_with_property()
1015 return np; in of_find_node_with_property()
1078 struct device_node *np; in of_find_matching_node_and_match() local
1086 for_each_of_allnodes_from(from, np) { in of_find_matching_node_and_match()
1087 m = __of_match_node(matches, np); in of_find_matching_node_and_match()
1088 if (m && of_node_get(np)) { in of_find_matching_node_and_match()
1096 return np; in of_find_matching_node_and_match()
1136 struct device_node *np = NULL; in of_find_node_by_phandle() local
1150 np = phandle_cache[masked_handle]; in of_find_node_by_phandle()
1153 if (!np) { in of_find_node_by_phandle()
1154 for_each_of_allnodes(np) in of_find_node_by_phandle()
1155 if (np->phandle == handle) { in of_find_node_by_phandle()
1157 phandle_cache[masked_handle] = np; in of_find_node_by_phandle()
1162 of_node_get(np); in of_find_node_by_phandle()
1164 return np; in of_find_node_by_phandle()
1171 printk("%s %pOF", msg, args->np); in of_print_phandle_args()
1181 const struct device_node *np, in of_phandle_iterator_init() argument
1191 list = of_get_property(np, list_name, &size); in of_phandle_iterator_init()
1197 it->parent = np; in of_phandle_iterator_init()
1293 static int __of_parse_phandle_with_args(const struct device_node *np, in __of_parse_phandle_with_args() argument
1303 of_for_each_phandle(&it, rc, np, list_name, cells_name, cell_count) { in __of_parse_phandle_with_args()
1321 out_args->np = it.node; in __of_parse_phandle_with_args()
1355 struct device_node *of_parse_phandle(const struct device_node *np, in of_parse_phandle() argument
1363 if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0, in of_parse_phandle()
1367 return args.np; in of_parse_phandle()
1403 int of_parse_phandle_with_args(const struct device_node *np, const char *list_name, in of_parse_phandle_with_args() argument
1409 return __of_parse_phandle_with_args(np, list_name, cells_name, 0, in of_parse_phandle_with_args()
1456 int of_parse_phandle_with_args_map(const struct device_node *np, in of_parse_phandle_with_args_map() argument
1492 ret = __of_parse_phandle_with_args(np, list_name, cells_name, 0, index, in of_parse_phandle_with_args_map()
1498 cur = out_args->np; in of_parse_phandle_with_args_map()
1581 out_args->np = new; in of_parse_phandle_with_args_map()
1628 int of_parse_phandle_with_fixed_args(const struct device_node *np, in of_parse_phandle_with_fixed_args() argument
1634 return __of_parse_phandle_with_args(np, list_name, NULL, cell_count, in of_parse_phandle_with_fixed_args()
1654 int of_count_phandle_with_args(const struct device_node *np, const char *list_name, in of_count_phandle_with_args() argument
1660 rc = of_phandle_iterator_init(&it, np, list_name, cells_name, 0); in of_count_phandle_with_args()
1677 int __of_add_property(struct device_node *np, struct property *prop) in __of_add_property() argument
1682 next = &np->properties; in __of_add_property()
1698 int of_add_property(struct device_node *np, struct property *prop) in of_add_property() argument
1706 rc = __of_add_property(np, prop); in of_add_property()
1710 __of_add_property_sysfs(np, prop); in of_add_property()
1715 of_property_notify(OF_RECONFIG_ADD_PROPERTY, np, prop, NULL); in of_add_property()
1720 int __of_remove_property(struct device_node *np, struct property *prop) in __of_remove_property() argument
1724 for (next = &np->properties; *next; next = &(*next)->next) { in __of_remove_property()
1733 prop->next = np->deadprops; in __of_remove_property()
1734 np->deadprops = prop; in __of_remove_property()
1747 int of_remove_property(struct device_node *np, struct property *prop) in of_remove_property() argument
1758 rc = __of_remove_property(np, prop); in of_remove_property()
1762 __of_remove_property_sysfs(np, prop); in of_remove_property()
1767 of_property_notify(OF_RECONFIG_REMOVE_PROPERTY, np, prop, NULL); in of_remove_property()
1772 int __of_update_property(struct device_node *np, struct property *newprop, in __of_update_property() argument
1777 for (next = &np->properties; *next; next = &(*next)->next) { in __of_update_property()
1787 oldprop->next = np->deadprops; in __of_update_property()
1788 np->deadprops = oldprop; in __of_update_property()
1807 int of_update_property(struct device_node *np, struct property *newprop) in of_update_property() argument
1819 rc = __of_update_property(np, newprop, &oldprop); in of_update_property()
1823 __of_update_property_sysfs(np, newprop, oldprop); in of_update_property()
1828 of_property_notify(OF_RECONFIG_UPDATE_PROPERTY, np, newprop, oldprop); in of_update_property()
1833 static void of_alias_add(struct alias_prop *ap, struct device_node *np, in of_alias_add() argument
1836 ap->np = np; in of_alias_add()
1842 ap->alias, ap->stem, ap->id, np); in of_alias_add()
1883 struct device_node *np; in of_alias_scan() local
1893 np = of_find_node_by_path(pp->value); in of_alias_scan()
1894 if (!np) in of_alias_scan()
1912 of_alias_add(ap, np, id, start, len); in of_alias_scan()
1924 int of_alias_get_id(struct device_node *np, const char *stem) in of_alias_get_id() argument
1934 if (np == app->np) { in of_alias_get_id()
2002 struct device_node *of_find_next_cache_node(const struct device_node *np) in of_find_next_cache_node() argument
2006 cache_node = of_parse_phandle(np, "l2-cache", 0); in of_find_next_cache_node()
2008 cache_node = of_parse_phandle(np, "next-level-cache", 0); in of_find_next_cache_node()
2016 if (!strcmp(np->type, "cpu")) in of_find_next_cache_node()
2017 for_each_child_of_node(np, child) in of_find_next_cache_node()
2036 struct device_node *prev = NULL, *np = of_cpu_device_node_get(cpu); in of_find_last_cache_level() local
2038 while (np) { in of_find_last_cache_level()
2039 prev = np; in of_find_last_cache_level()
2040 of_node_put(np); in of_find_last_cache_level()
2041 np = of_find_next_cache_node(np); in of_find_last_cache_level()