/* * Process a node, adding entries for its children and its properties. */ void proc_device_tree_add_node(struct device_node *np, struct proc_dir_entry *de) { struct property *pp; struct proc_dir_entry *ent; struct device_node *child; const char *p; set_node_proc_entry(np, de); for (child = NULL; (child = of_get_next_child(np, child));) { p = strrchr(child->full_name, '/'); if (!p) p = child->full_name; else ++p; ent = proc_mkdir(p, de); if (ent == 0) break; proc_device_tree_add_node(child, ent); } of_node_put(child); for (pp = np->properties; pp != 0; pp = pp->next) { /* * Yet another Apple device-tree bogosity: on some machines, * they have properties & nodes with the same name. Those * properties are quite unimportant for us though, thus we * simply "skip" them here, but we do have to check. */ for (ent = de->subdir; ent != NULL; ent = ent->next) if (!strcmp(ent->name, pp->name)) break; if (ent != NULL) { printk(KERN_WARNING "device-tree: property \"%s\" name" " conflicts with node in %s\n", pp->name, np->full_name); continue; } ent = __proc_device_tree_add_prop(de, pp); if (ent == 0) break; } }
/* * Process a node, adding entries for its children and its properties. */ void proc_device_tree_add_node(struct device_node *np, struct proc_dir_entry *de) { struct property *pp; struct proc_dir_entry *ent; struct device_node *child; const char *p; set_node_proc_entry(np, de); for (child = NULL; (child = of_get_next_child(np, child));) { /* Use everything after the last slash, or the full name */ p = strrchr(child->full_name, '/'); if (!p) p = child->full_name; else ++p; if (duplicate_name(de, p)) p = fixup_name(np, de, p); ent = proc_mkdir(p, de); if (ent == NULL) break; proc_device_tree_add_node(child, ent); } of_node_put(child); for (pp = np->properties; pp != NULL; pp = pp->next) { p = pp->name; if (strchr(p, '/')) continue; if (duplicate_name(de, p)) p = fixup_name(np, de, p); ent = __proc_device_tree_add_prop(de, pp, p); if (ent == NULL) break; } }