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
180 for_each_of_allnodes(np) { in of_core_init()
181 __of_attach_node_sysfs(np); in of_core_init()
182 if (np->phandle && !phandle_cache[of_phandle_cache_hash(np->phandle)]) in of_core_init()
183 phandle_cache[of_phandle_cache_hash(np->phandle)] = np; in of_core_init()
192 static struct property *__of_find_property(const struct device_node *np, in __of_find_property() argument
197 if (!np) in __of_find_property()
200 for (pp = np->properties; pp; pp = pp->next) { in __of_find_property()
211 struct property *of_find_property(const struct device_node *np, in of_find_property() argument
219 pp = __of_find_property(np, name, lenp); in of_find_property()
228 struct device_node *np; in __of_find_all_nodes() local
230 np = of_root; in __of_find_all_nodes()
232 np = prev->child; in __of_find_all_nodes()
235 np = prev; in __of_find_all_nodes()
236 while (np->parent && !np->sibling) in __of_find_all_nodes()
237 np = np->parent; in __of_find_all_nodes()
238 np = np->sibling; /* Might be null at the end of the tree */ in __of_find_all_nodes()
240 return np; in __of_find_all_nodes()
253 struct device_node *np; in of_find_all_nodes() local
257 np = __of_find_all_nodes(prev); in of_find_all_nodes()
258 of_node_get(np); in of_find_all_nodes()
261 return np; in of_find_all_nodes()
269 const void *__of_get_property(const struct device_node *np, in __of_get_property() argument
272 struct property *pp = __of_find_property(np, name, lenp); in __of_get_property()
281 const void *of_get_property(const struct device_node *np, const char *name, in of_get_property() argument
284 struct property *pp = of_find_property(np, name, lenp); in of_get_property()
521 struct device_node *np; in of_get_parent() local
528 np = of_node_get(node->parent); in of_get_parent()
530 return np; in of_get_parent()
777 struct device_node *np = NULL; in of_find_node_opts_by_path() local
803 np = of_find_node_by_path(pp->value); in of_find_node_opts_by_path()
807 if (!np) in of_find_node_opts_by_path()
814 if (!np) in of_find_node_opts_by_path()
815 np = of_node_get(of_root); in of_find_node_opts_by_path()
816 np = __of_find_node_by_full_path(np, path); in of_find_node_opts_by_path()
818 return np; in of_find_node_opts_by_path()
836 struct device_node *np; in of_find_node_by_name() local
840 for_each_of_allnodes_from(from, np) in of_find_node_by_name()
841 if (of_node_name_eq(np, name) && of_node_get(np)) in of_find_node_by_name()
845 return np; in of_find_node_by_name()
864 struct device_node *np; in of_find_node_by_type() local
868 for_each_of_allnodes_from(from, np) in of_find_node_by_type()
869 if (__of_node_is_type(np, type) && of_node_get(np)) in of_find_node_by_type()
873 return np; in of_find_node_by_type()
894 struct device_node *np; in of_find_compatible_node() local
898 for_each_of_allnodes_from(from, np) in of_find_compatible_node()
899 if (__of_device_is_compatible(np, compatible, type, NULL) && in of_find_compatible_node()
900 of_node_get(np)) in of_find_compatible_node()
904 return np; in of_find_compatible_node()
923 struct device_node *np; in of_find_node_with_property() local
928 for_each_of_allnodes_from(from, np) { in of_find_node_with_property()
929 for (pp = np->properties; pp; pp = pp->next) { in of_find_node_with_property()
931 of_node_get(np); in of_find_node_with_property()
939 return np; in of_find_node_with_property()
1002 struct device_node *np; in of_find_matching_node_and_match() local
1010 for_each_of_allnodes_from(from, np) { in of_find_matching_node_and_match()
1011 m = __of_match_node(matches, np); in of_find_matching_node_and_match()
1012 if (m && of_node_get(np)) { in of_find_matching_node_and_match()
1020 return np; in of_find_matching_node_and_match()
1064 struct device_node *np = NULL; in of_find_node_by_phandle() local
1077 np = phandle_cache[handle_hash]; in of_find_node_by_phandle()
1079 if (!np) { in of_find_node_by_phandle()
1080 for_each_of_allnodes(np) in of_find_node_by_phandle()
1081 if (np->phandle == handle && in of_find_node_by_phandle()
1082 !of_node_check_flag(np, OF_DETACHED)) { in of_find_node_by_phandle()
1083 phandle_cache[handle_hash] = np; in of_find_node_by_phandle()
1088 of_node_get(np); in of_find_node_by_phandle()
1090 return np; in of_find_node_by_phandle()
1097 printk("%s %pOF", msg, args->np); in of_print_phandle_args()
1107 const struct device_node *np, in of_phandle_iterator_init() argument
1124 list = of_get_property(np, list_name, &size); in of_phandle_iterator_init()
1130 it->parent = np; in of_phandle_iterator_init()
1241 int __of_parse_phandle_with_args(const struct device_node *np, in __of_parse_phandle_with_args() argument
1254 of_for_each_phandle(&it, rc, np, list_name, cells_name, cell_count) { in __of_parse_phandle_with_args()
1272 out_args->np = it.node; in __of_parse_phandle_with_args()
1339 int of_parse_phandle_with_args_map(const struct device_node *np, in of_parse_phandle_with_args_map() argument
1375 ret = __of_parse_phandle_with_args(np, list_name, cells_name, -1, index, in of_parse_phandle_with_args_map()
1381 cur = out_args->np; in of_parse_phandle_with_args_map()
1464 out_args->np = new; in of_parse_phandle_with_args_map()
1497 int of_count_phandle_with_args(const struct device_node *np, const char *list_name, in of_count_phandle_with_args() argument
1513 list = of_get_property(np, list_name, &size); in of_count_phandle_with_args()
1520 rc = of_phandle_iterator_init(&it, np, list_name, cells_name, -1); in of_count_phandle_with_args()
1553 int __of_add_property(struct device_node *np, struct property *prop) in __of_add_property() argument
1561 __of_remove_property_from_list(&np->deadprops, prop); in __of_add_property()
1564 next = &np->properties; in __of_add_property()
1580 __of_add_property_sysfs(np, prop); in __of_add_property()
1589 int of_add_property(struct device_node *np, struct property *prop) in of_add_property() argument
1594 rc = __of_add_property(np, prop); in of_add_property()
1598 of_property_notify(OF_RECONFIG_ADD_PROPERTY, np, prop, NULL); in of_add_property()
1604 int __of_remove_property(struct device_node *np, struct property *prop) in __of_remove_property() argument
1611 if (__of_remove_property_from_list(&np->properties, prop)) { in __of_remove_property()
1613 prop->next = np->deadprops; in __of_remove_property()
1614 np->deadprops = prop; in __of_remove_property()
1622 __of_remove_property_sysfs(np, prop); in __of_remove_property()
1636 int of_remove_property(struct device_node *np, struct property *prop) in of_remove_property() argument
1644 rc = __of_remove_property(np, prop); in of_remove_property()
1648 of_property_notify(OF_RECONFIG_REMOVE_PROPERTY, np, prop, NULL); in of_remove_property()
1654 int __of_update_property(struct device_node *np, struct property *newprop, in __of_update_property() argument
1662 __of_remove_property_from_list(&np->deadprops, newprop); in __of_update_property()
1664 for (next = &np->properties; *next; next = &(*next)->next) { in __of_update_property()
1674 oldprop->next = np->deadprops; in __of_update_property()
1675 np->deadprops = oldprop; in __of_update_property()
1684 __of_update_property_sysfs(np, newprop, oldprop); in __of_update_property()
1698 int of_update_property(struct device_node *np, struct property *newprop) in of_update_property() argument
1707 rc = __of_update_property(np, newprop, &oldprop); in of_update_property()
1711 of_property_notify(OF_RECONFIG_UPDATE_PROPERTY, np, newprop, oldprop); in of_update_property()
1716 static void of_alias_add(struct alias_prop *ap, struct device_node *np, in of_alias_add() argument
1719 ap->np = np; in of_alias_add()
1724 ap->alias, ap->stem, ap->id, np); in of_alias_add()
1766 struct device_node *np; in of_alias_scan() local
1776 np = of_find_node_by_path(pp->value); in of_alias_scan()
1777 if (!np) in of_alias_scan()
1795 of_alias_add(ap, np, id, start, len); in of_alias_scan()
1809 int of_alias_get_id(struct device_node *np, const char *stem) in of_alias_get_id() argument
1819 if (np == app->np) { in of_alias_get_id()
1888 struct device_node *of_find_next_cache_node(const struct device_node *np) in of_find_next_cache_node() argument
1892 cache_node = of_parse_phandle(np, "l2-cache", 0); in of_find_next_cache_node()
1894 cache_node = of_parse_phandle(np, "next-level-cache", 0); in of_find_next_cache_node()
1902 if (IS_ENABLED(CONFIG_PPC_PMAC) && of_node_is_type(np, "cpu")) in of_find_next_cache_node()
1903 for_each_child_of_node(np, child) in of_find_next_cache_node()
1922 struct device_node *prev = NULL, *np = of_cpu_device_node_get(cpu); in of_find_last_cache_level() local
1924 while (np) { in of_find_last_cache_level()
1926 prev = np; in of_find_last_cache_level()
1927 np = of_find_next_cache_node(np); in of_find_last_cache_level()
1955 int of_map_id(struct device_node *np, u32 id, in of_map_id() argument
1963 if (!np || !map_name || (!target && !id_out)) in of_map_id()
1966 map = of_get_property(np, map_name, &map_len); in of_map_id()
1976 pr_err("%pOF: Error: Bad %s length: %d\n", np, in of_map_id()
1989 of_property_read_u32(np, map_mask_name, &map_mask); in of_map_id()
2001 np, map_name, map_name, in of_map_id()
2027 np, map_name, map_mask, id_base, out_base, in of_map_id()
2032 pr_info("%pOF: no %s translation for id 0x%x on %pOF\n", np, map_name, in of_map_id()