Lines Matching refs:np

57 int of_n_addr_cells(struct device_node *np)  in of_n_addr_cells()  argument
62 if (np->parent) in of_n_addr_cells()
63 np = np->parent; in of_n_addr_cells()
64 ip = of_get_property(np, "#address-cells", NULL); in of_n_addr_cells()
67 } while (np->parent); in of_n_addr_cells()
73 int of_n_size_cells(struct device_node *np) in of_n_size_cells() argument
78 if (np->parent) in of_n_size_cells()
79 np = np->parent; in of_n_size_cells()
80 ip = of_get_property(np, "#size-cells", NULL); in of_n_size_cells()
83 } while (np->parent); in of_n_size_cells()
90 int __weak of_node_to_nid(struct device_node *np) in of_node_to_nid() argument
135 int __of_add_property_sysfs(struct device_node *np, struct property *pp) in __of_add_property_sysfs() argument
145 if (!of_kset || !of_node_is_attached(np)) in __of_add_property_sysfs()
149 pp->attr.attr.name = safe_name(&np->kobj, pp->name); in __of_add_property_sysfs()
154 rc = sysfs_create_bin_file(&np->kobj, &pp->attr); in __of_add_property_sysfs()
155 WARN(rc, "error adding attribute %s to node %s\n", pp->name, np->full_name); in __of_add_property_sysfs()
159 int __of_attach_node_sysfs(struct device_node *np) in __of_attach_node_sysfs() argument
171 np->kobj.kset = of_kset; in __of_attach_node_sysfs()
172 if (!np->parent) { in __of_attach_node_sysfs()
174 rc = kobject_add(&np->kobj, NULL, "%s", in __of_attach_node_sysfs()
177 name = safe_name(&np->parent->kobj, kbasename(np->full_name)); in __of_attach_node_sysfs()
181 rc = kobject_add(&np->kobj, &np->parent->kobj, "%s", name); in __of_attach_node_sysfs()
186 for_each_property_of_node(np, pp) in __of_attach_node_sysfs()
187 __of_add_property_sysfs(np, pp); in __of_attach_node_sysfs()
194 struct device_node *np; in of_core_init() local
204 for_each_of_allnodes(np) in of_core_init()
205 __of_attach_node_sysfs(np); in of_core_init()
213 static struct property *__of_find_property(const struct device_node *np, in __of_find_property() argument
218 if (!np) in __of_find_property()
221 for (pp = np->properties; pp; pp = pp->next) { in __of_find_property()
232 struct property *of_find_property(const struct device_node *np, in of_find_property() argument
240 pp = __of_find_property(np, name, lenp); in of_find_property()
249 struct device_node *np; in __of_find_all_nodes() local
251 np = of_root; in __of_find_all_nodes()
253 np = prev->child; in __of_find_all_nodes()
256 np = prev; in __of_find_all_nodes()
257 while (np->parent && !np->sibling) in __of_find_all_nodes()
258 np = np->parent; in __of_find_all_nodes()
259 np = np->sibling; /* Might be null at the end of the tree */ in __of_find_all_nodes()
261 return np; in __of_find_all_nodes()
274 struct device_node *np; in of_find_all_nodes() local
278 np = __of_find_all_nodes(prev); in of_find_all_nodes()
279 of_node_get(np); in of_find_all_nodes()
282 return np; in of_find_all_nodes()
290 const void *__of_get_property(const struct device_node *np, in __of_get_property() argument
293 struct property *pp = __of_find_property(np, name, lenp); in __of_get_property()
302 const void *of_get_property(const struct device_node *np, const char *name, in of_get_property() argument
305 struct property *pp = of_find_property(np, name, lenp); in of_get_property()
600 struct device_node *np; in of_get_parent() local
607 np = of_node_get(node->parent); in of_get_parent()
609 return np; in of_get_parent()
776 struct device_node *np = NULL; in of_find_node_opts_by_path() local
802 np = of_find_node_by_path(pp->value); in of_find_node_opts_by_path()
806 if (!np) in of_find_node_opts_by_path()
813 if (!np) in of_find_node_opts_by_path()
814 np = of_node_get(of_root); in of_find_node_opts_by_path()
815 while (np && *path == '/') { in of_find_node_opts_by_path()
817 np = __of_find_node_by_path(np, path); in of_find_node_opts_by_path()
823 return np; in of_find_node_opts_by_path()
841 struct device_node *np; in of_find_node_by_name() local
845 for_each_of_allnodes_from(from, np) in of_find_node_by_name()
846 if (np->name && (of_node_cmp(np->name, name) == 0) in of_find_node_by_name()
847 && of_node_get(np)) in of_find_node_by_name()
851 return np; in of_find_node_by_name()
870 struct device_node *np; in of_find_node_by_type() local
874 for_each_of_allnodes_from(from, np) in of_find_node_by_type()
875 if (np->type && (of_node_cmp(np->type, type) == 0) in of_find_node_by_type()
876 && of_node_get(np)) in of_find_node_by_type()
880 return np; in of_find_node_by_type()
901 struct device_node *np; in of_find_compatible_node() local
905 for_each_of_allnodes_from(from, np) in of_find_compatible_node()
906 if (__of_device_is_compatible(np, compatible, type, NULL) && in of_find_compatible_node()
907 of_node_get(np)) in of_find_compatible_node()
911 return np; in of_find_compatible_node()
930 struct device_node *np; in of_find_node_with_property() local
935 for_each_of_allnodes_from(from, np) { in of_find_node_with_property()
936 for (pp = np->properties; pp; pp = pp->next) { in of_find_node_with_property()
938 of_node_get(np); in of_find_node_with_property()
946 return np; in of_find_node_with_property()
1009 struct device_node *np; in of_find_matching_node_and_match() local
1017 for_each_of_allnodes_from(from, np) { in of_find_matching_node_and_match()
1018 m = __of_match_node(matches, np); in of_find_matching_node_and_match()
1019 if (m && of_node_get(np)) { in of_find_matching_node_and_match()
1027 return np; in of_find_matching_node_and_match()
1067 struct device_node *np; in of_find_node_by_phandle() local
1074 for_each_of_allnodes(np) in of_find_node_by_phandle()
1075 if (np->phandle == handle) in of_find_node_by_phandle()
1077 of_node_get(np); in of_find_node_by_phandle()
1079 return np; in of_find_node_by_phandle()
1095 int of_property_count_elems_of_size(const struct device_node *np, in of_property_count_elems_of_size() argument
1098 struct property *prop = of_find_property(np, propname, NULL); in of_property_count_elems_of_size()
1107 propname, np->full_name, elem_size); in of_property_count_elems_of_size()
1128 static void *of_find_property_value_of_size(const struct device_node *np, in of_find_property_value_of_size() argument
1131 struct property *prop = of_find_property(np, propname, NULL); in of_find_property_value_of_size()
1158 int of_property_read_u32_index(const struct device_node *np, in of_property_read_u32_index() argument
1162 const u32 *val = of_find_property_value_of_size(np, propname, in of_property_read_u32_index()
1191 int of_property_read_u8_array(const struct device_node *np, in of_property_read_u8_array() argument
1194 const u8 *val = of_find_property_value_of_size(np, propname, in of_property_read_u8_array()
1224 int of_property_read_u16_array(const struct device_node *np, in of_property_read_u16_array() argument
1227 const __be16 *val = of_find_property_value_of_size(np, propname, in of_property_read_u16_array()
1255 int of_property_read_u32_array(const struct device_node *np, in of_property_read_u32_array() argument
1259 const __be32 *val = of_find_property_value_of_size(np, propname, in of_property_read_u32_array()
1284 int of_property_read_u64(const struct device_node *np, const char *propname, in of_property_read_u64() argument
1287 const __be32 *val = of_find_property_value_of_size(np, propname, in of_property_read_u64()
1314 int of_property_read_u64_array(const struct device_node *np, in of_property_read_u64_array() argument
1318 const __be32 *val = of_find_property_value_of_size(np, propname, in of_property_read_u64_array()
1347 int of_property_read_string(struct device_node *np, const char *propname, in of_property_read_string() argument
1350 struct property *prop = of_find_property(np, propname, NULL); in of_property_read_string()
1371 int of_property_match_string(struct device_node *np, const char *propname, in of_property_match_string() argument
1374 struct property *prop = of_find_property(np, propname, NULL); in of_property_match_string()
1410 int of_property_read_string_helper(struct device_node *np, const char *propname, in of_property_read_string_helper() argument
1413 struct property *prop = of_find_property(np, propname, NULL); in of_property_read_string_helper()
1439 printk("%s %s", msg, of_node_full_name(args->np)); in of_print_phandle_args()
1445 static int __of_parse_phandle_with_args(const struct device_node *np, in __of_parse_phandle_with_args() argument
1458 list = of_get_property(np, list_name, &size); in __of_parse_phandle_with_args()
1487 np->full_name); in __of_parse_phandle_with_args()
1496 np->full_name, cells_name, in __of_parse_phandle_with_args()
1510 np->full_name); in __of_parse_phandle_with_args()
1530 out_args->np = node; in __of_parse_phandle_with_args()
1571 struct device_node *of_parse_phandle(const struct device_node *np, in of_parse_phandle() argument
1579 if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0, in of_parse_phandle()
1583 return args.np; in of_parse_phandle()
1619 int of_parse_phandle_with_args(const struct device_node *np, const char *list_name, in of_parse_phandle_with_args() argument
1625 return __of_parse_phandle_with_args(np, list_name, cells_name, 0, in of_parse_phandle_with_args()
1660 int of_parse_phandle_with_fixed_args(const struct device_node *np, in of_parse_phandle_with_fixed_args() argument
1666 return __of_parse_phandle_with_args(np, list_name, NULL, cell_count, in of_parse_phandle_with_fixed_args()
1686 int of_count_phandle_with_args(const struct device_node *np, const char *list_name, in of_count_phandle_with_args() argument
1689 return __of_parse_phandle_with_args(np, list_name, cells_name, 0, -1, in of_count_phandle_with_args()
1697 int __of_add_property(struct device_node *np, struct property *prop) in __of_add_property() argument
1702 next = &np->properties; in __of_add_property()
1718 int of_add_property(struct device_node *np, struct property *prop) in of_add_property() argument
1726 rc = __of_add_property(np, prop); in of_add_property()
1730 __of_add_property_sysfs(np, prop); in of_add_property()
1735 of_property_notify(OF_RECONFIG_ADD_PROPERTY, np, prop, NULL); in of_add_property()
1740 int __of_remove_property(struct device_node *np, struct property *prop) in __of_remove_property() argument
1744 for (next = &np->properties; *next; next = &(*next)->next) { in __of_remove_property()
1753 prop->next = np->deadprops; in __of_remove_property()
1754 np->deadprops = prop; in __of_remove_property()
1759 void __of_remove_property_sysfs(struct device_node *np, struct property *prop) in __of_remove_property_sysfs() argument
1765 if (of_kset && of_node_is_attached(np)) in __of_remove_property_sysfs()
1766 sysfs_remove_bin_file(&np->kobj, &prop->attr); in __of_remove_property_sysfs()
1777 int of_remove_property(struct device_node *np, struct property *prop) in of_remove_property() argument
1785 rc = __of_remove_property(np, prop); in of_remove_property()
1789 __of_remove_property_sysfs(np, prop); in of_remove_property()
1794 of_property_notify(OF_RECONFIG_REMOVE_PROPERTY, np, prop, NULL); in of_remove_property()
1799 int __of_update_property(struct device_node *np, struct property *newprop, in __of_update_property() argument
1804 for (next = &np->properties; *next; next = &(*next)->next) { in __of_update_property()
1814 oldprop->next = np->deadprops; in __of_update_property()
1815 np->deadprops = oldprop; in __of_update_property()
1825 void __of_update_property_sysfs(struct device_node *np, struct property *newprop, in __of_update_property_sysfs() argument
1836 sysfs_remove_bin_file(&np->kobj, &oldprop->attr); in __of_update_property_sysfs()
1837 __of_add_property_sysfs(np, newprop); in __of_update_property_sysfs()
1849 int of_update_property(struct device_node *np, struct property *newprop) in of_update_property() argument
1861 rc = __of_update_property(np, newprop, &oldprop); in of_update_property()
1865 __of_update_property_sysfs(np, newprop, oldprop); in of_update_property()
1870 of_property_notify(OF_RECONFIG_UPDATE_PROPERTY, np, newprop, oldprop); in of_update_property()
1875 static void of_alias_add(struct alias_prop *ap, struct device_node *np, in of_alias_add() argument
1878 ap->np = np; in of_alias_add()
1884 ap->alias, ap->stem, ap->id, of_node_full_name(np)); in of_alias_add()
1923 struct device_node *np; in of_alias_scan() local
1933 np = of_find_node_by_path(pp->value); in of_alias_scan()
1934 if (!np) in of_alias_scan()
1952 of_alias_add(ap, np, id, start, len); in of_alias_scan()
1964 int of_alias_get_id(struct device_node *np, const char *stem) in of_alias_get_id() argument
1974 if (np == app->np) { in of_alias_get_id()
2079 struct device_node *of_find_next_cache_node(const struct device_node *np) in of_find_next_cache_node() argument
2084 handle = of_get_property(np, "l2-cache", NULL); in of_find_next_cache_node()
2086 handle = of_get_property(np, "next-level-cache", NULL); in of_find_next_cache_node()
2094 if (!strcmp(np->type, "cpu")) in of_find_next_cache_node()
2095 for_each_child_of_node(np, child) in of_find_next_cache_node()
2243 struct device_node *np; in of_graph_get_remote_port_parent() local
2247 np = of_parse_phandle(node, "remote-endpoint", 0); in of_graph_get_remote_port_parent()
2250 for (depth = 3; depth && np; depth--) { in of_graph_get_remote_port_parent()
2251 np = of_get_next_parent(np); in of_graph_get_remote_port_parent()
2252 if (depth == 2 && of_node_cmp(np->name, "ports")) in of_graph_get_remote_port_parent()
2255 return np; in of_graph_get_remote_port_parent()
2268 struct device_node *np; in of_graph_get_remote_port() local
2271 np = of_parse_phandle(node, "remote-endpoint", 0); in of_graph_get_remote_port()
2272 if (!np) in of_graph_get_remote_port()
2274 return of_get_next_parent(np); in of_graph_get_remote_port()