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()
597 struct device_node *np; in of_get_parent() local
604 np = of_node_get(node->parent); in of_get_parent()
606 return np; in of_get_parent()
773 struct device_node *np = NULL; in of_find_node_opts_by_path() local
799 np = of_find_node_by_path(pp->value); in of_find_node_opts_by_path()
803 if (!np) in of_find_node_opts_by_path()
810 if (!np) in of_find_node_opts_by_path()
811 np = of_node_get(of_root); in of_find_node_opts_by_path()
812 while (np && *path == '/') { in of_find_node_opts_by_path()
814 np = __of_find_node_by_path(np, path); in of_find_node_opts_by_path()
820 return np; in of_find_node_opts_by_path()
838 struct device_node *np; in of_find_node_by_name() local
842 for_each_of_allnodes_from(from, np) in of_find_node_by_name()
843 if (np->name && (of_node_cmp(np->name, name) == 0) in of_find_node_by_name()
844 && of_node_get(np)) in of_find_node_by_name()
848 return np; in of_find_node_by_name()
867 struct device_node *np; in of_find_node_by_type() local
871 for_each_of_allnodes_from(from, np) in of_find_node_by_type()
872 if (np->type && (of_node_cmp(np->type, type) == 0) in of_find_node_by_type()
873 && of_node_get(np)) in of_find_node_by_type()
877 return np; in of_find_node_by_type()
898 struct device_node *np; in of_find_compatible_node() local
902 for_each_of_allnodes_from(from, np) in of_find_compatible_node()
903 if (__of_device_is_compatible(np, compatible, type, NULL) && in of_find_compatible_node()
904 of_node_get(np)) in of_find_compatible_node()
908 return np; in of_find_compatible_node()
927 struct device_node *np; in of_find_node_with_property() local
932 for_each_of_allnodes_from(from, np) { in of_find_node_with_property()
933 for (pp = np->properties; pp; pp = pp->next) { in of_find_node_with_property()
935 of_node_get(np); in of_find_node_with_property()
943 return np; in of_find_node_with_property()
1006 struct device_node *np; in of_find_matching_node_and_match() local
1014 for_each_of_allnodes_from(from, np) { in of_find_matching_node_and_match()
1015 m = __of_match_node(matches, np); in of_find_matching_node_and_match()
1016 if (m && of_node_get(np)) { in of_find_matching_node_and_match()
1024 return np; in of_find_matching_node_and_match()
1064 struct device_node *np; in of_find_node_by_phandle() local
1071 for_each_of_allnodes(np) in of_find_node_by_phandle()
1072 if (np->phandle == handle) in of_find_node_by_phandle()
1074 of_node_get(np); in of_find_node_by_phandle()
1076 return np; in of_find_node_by_phandle()
1092 int of_property_count_elems_of_size(const struct device_node *np, in of_property_count_elems_of_size() argument
1095 struct property *prop = of_find_property(np, propname, NULL); in of_property_count_elems_of_size()
1104 propname, np->full_name, elem_size); in of_property_count_elems_of_size()
1125 static void *of_find_property_value_of_size(const struct device_node *np, in of_find_property_value_of_size() argument
1128 struct property *prop = of_find_property(np, propname, NULL); in of_find_property_value_of_size()
1155 int of_property_read_u32_index(const struct device_node *np, in of_property_read_u32_index() argument
1159 const u32 *val = of_find_property_value_of_size(np, propname, in of_property_read_u32_index()
1188 int of_property_read_u8_array(const struct device_node *np, in of_property_read_u8_array() argument
1191 const u8 *val = of_find_property_value_of_size(np, propname, in of_property_read_u8_array()
1221 int of_property_read_u16_array(const struct device_node *np, in of_property_read_u16_array() argument
1224 const __be16 *val = of_find_property_value_of_size(np, propname, in of_property_read_u16_array()
1252 int of_property_read_u32_array(const struct device_node *np, in of_property_read_u32_array() argument
1256 const __be32 *val = of_find_property_value_of_size(np, propname, in of_property_read_u32_array()
1281 int of_property_read_u64(const struct device_node *np, const char *propname, in of_property_read_u64() argument
1284 const __be32 *val = of_find_property_value_of_size(np, propname, in of_property_read_u64()
1311 int of_property_read_u64_array(const struct device_node *np, in of_property_read_u64_array() argument
1315 const __be32 *val = of_find_property_value_of_size(np, propname, in of_property_read_u64_array()
1344 int of_property_read_string(struct device_node *np, const char *propname, in of_property_read_string() argument
1347 struct property *prop = of_find_property(np, propname, NULL); in of_property_read_string()
1368 int of_property_match_string(struct device_node *np, const char *propname, in of_property_match_string() argument
1371 struct property *prop = of_find_property(np, propname, NULL); in of_property_match_string()
1407 int of_property_read_string_helper(struct device_node *np, const char *propname, in of_property_read_string_helper() argument
1410 struct property *prop = of_find_property(np, propname, NULL); in of_property_read_string_helper()
1436 printk("%s %s", msg, of_node_full_name(args->np)); in of_print_phandle_args()
1442 static int __of_parse_phandle_with_args(const struct device_node *np, in __of_parse_phandle_with_args() argument
1455 list = of_get_property(np, list_name, &size); in __of_parse_phandle_with_args()
1484 np->full_name); in __of_parse_phandle_with_args()
1493 np->full_name, cells_name, in __of_parse_phandle_with_args()
1507 np->full_name); in __of_parse_phandle_with_args()
1527 out_args->np = node; in __of_parse_phandle_with_args()
1568 struct device_node *of_parse_phandle(const struct device_node *np, in of_parse_phandle() argument
1576 if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0, in of_parse_phandle()
1580 return args.np; in of_parse_phandle()
1616 int of_parse_phandle_with_args(const struct device_node *np, const char *list_name, in of_parse_phandle_with_args() argument
1622 return __of_parse_phandle_with_args(np, list_name, cells_name, 0, in of_parse_phandle_with_args()
1657 int of_parse_phandle_with_fixed_args(const struct device_node *np, in of_parse_phandle_with_fixed_args() argument
1663 return __of_parse_phandle_with_args(np, list_name, NULL, cell_count, in of_parse_phandle_with_fixed_args()
1683 int of_count_phandle_with_args(const struct device_node *np, const char *list_name, in of_count_phandle_with_args() argument
1686 return __of_parse_phandle_with_args(np, list_name, cells_name, 0, -1, in of_count_phandle_with_args()
1694 int __of_add_property(struct device_node *np, struct property *prop) in __of_add_property() argument
1699 next = &np->properties; in __of_add_property()
1715 int of_add_property(struct device_node *np, struct property *prop) in of_add_property() argument
1723 rc = __of_add_property(np, prop); in of_add_property()
1727 __of_add_property_sysfs(np, prop); in of_add_property()
1732 of_property_notify(OF_RECONFIG_ADD_PROPERTY, np, prop, NULL); in of_add_property()
1737 int __of_remove_property(struct device_node *np, struct property *prop) in __of_remove_property() argument
1741 for (next = &np->properties; *next; next = &(*next)->next) { in __of_remove_property()
1750 prop->next = np->deadprops; in __of_remove_property()
1751 np->deadprops = prop; in __of_remove_property()
1756 void __of_remove_property_sysfs(struct device_node *np, struct property *prop) in __of_remove_property_sysfs() argument
1762 if (of_kset && of_node_is_attached(np)) in __of_remove_property_sysfs()
1763 sysfs_remove_bin_file(&np->kobj, &prop->attr); in __of_remove_property_sysfs()
1774 int of_remove_property(struct device_node *np, struct property *prop) in of_remove_property() argument
1782 rc = __of_remove_property(np, prop); in of_remove_property()
1786 __of_remove_property_sysfs(np, prop); in of_remove_property()
1791 of_property_notify(OF_RECONFIG_REMOVE_PROPERTY, np, prop, NULL); in of_remove_property()
1796 int __of_update_property(struct device_node *np, struct property *newprop, in __of_update_property() argument
1801 for (next = &np->properties; *next; next = &(*next)->next) { in __of_update_property()
1811 oldprop->next = np->deadprops; in __of_update_property()
1812 np->deadprops = oldprop; in __of_update_property()
1822 void __of_update_property_sysfs(struct device_node *np, struct property *newprop, in __of_update_property_sysfs() argument
1833 sysfs_remove_bin_file(&np->kobj, &oldprop->attr); in __of_update_property_sysfs()
1834 __of_add_property_sysfs(np, newprop); in __of_update_property_sysfs()
1846 int of_update_property(struct device_node *np, struct property *newprop) in of_update_property() argument
1858 rc = __of_update_property(np, newprop, &oldprop); in of_update_property()
1862 __of_update_property_sysfs(np, newprop, oldprop); in of_update_property()
1867 of_property_notify(OF_RECONFIG_UPDATE_PROPERTY, np, newprop, oldprop); in of_update_property()
1872 static void of_alias_add(struct alias_prop *ap, struct device_node *np, in of_alias_add() argument
1875 ap->np = np; in of_alias_add()
1881 ap->alias, ap->stem, ap->id, of_node_full_name(np)); in of_alias_add()
1920 struct device_node *np; in of_alias_scan() local
1930 np = of_find_node_by_path(pp->value); in of_alias_scan()
1931 if (!np) in of_alias_scan()
1949 of_alias_add(ap, np, id, start, len); in of_alias_scan()
1961 int of_alias_get_id(struct device_node *np, const char *stem) in of_alias_get_id() argument
1971 if (np == app->np) { in of_alias_get_id()
2076 struct device_node *of_find_next_cache_node(const struct device_node *np) in of_find_next_cache_node() argument
2081 handle = of_get_property(np, "l2-cache", NULL); in of_find_next_cache_node()
2083 handle = of_get_property(np, "next-level-cache", NULL); in of_find_next_cache_node()
2091 if (!strcmp(np->type, "cpu")) in of_find_next_cache_node()
2092 for_each_child_of_node(np, child) in of_find_next_cache_node()
2274 struct device_node *np; in of_graph_get_remote_port_parent() local
2278 np = of_parse_phandle(node, "remote-endpoint", 0); in of_graph_get_remote_port_parent()
2281 for (depth = 3; depth && np; depth--) { in of_graph_get_remote_port_parent()
2282 np = of_get_next_parent(np); in of_graph_get_remote_port_parent()
2283 if (depth == 2 && of_node_cmp(np->name, "ports")) in of_graph_get_remote_port_parent()
2286 return np; in of_graph_get_remote_port_parent()
2299 struct device_node *np; in of_graph_get_remote_port() local
2302 np = of_parse_phandle(node, "remote-endpoint", 0); in of_graph_get_remote_port()
2303 if (!np) in of_graph_get_remote_port()
2305 return of_get_next_parent(np); in of_graph_get_remote_port()