diff options
| author | Andrew Morton <akpm@osdl.org> | 2004-01-18 18:12:33 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2004-01-18 18:12:33 -0800 |
| commit | 40a4a0aaad534be2b05904f27c64c735dc989944 (patch) | |
| tree | 56fa29925fab67ca0934b48241fbd07136f23dce | |
| parent | aafb95619158e15a5398f30734998b8ef5f6d650 (diff) | |
[PATCH] ppc64: support for runtime updates of /proc/device-tree, from Nathan Lynch
From: Anton Blanchard <anton@samba.org>
support for runtime updates of /proc/device-tree, from Nathan Lynch
| -rw-r--r-- | fs/proc/proc_devtree.c | 39 | ||||
| -rw-r--r-- | include/linux/proc_fs.h | 1 |
2 files changed, 32 insertions, 8 deletions
diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c index bc62cac8ce3a..e7c813c99848 100644 --- a/fs/proc/proc_devtree.c +++ b/fs/proc/proc_devtree.c @@ -11,6 +11,20 @@ #include <asm/prom.h> #include <asm/uaccess.h> +#ifndef HAVE_ARCH_DEVTREE_FIXUPS +static inline void set_node_proc_entry(struct device_node *np, struct proc_dir_entry *de) +{ +} + +static void inline set_node_name_link(struct device_node *np, struct proc_dir_entry *de) +{ +} + +static void inline set_node_addr_link(struct device_node *np, struct proc_dir_entry *de) +{ +} +#endif + static struct proc_dir_entry *proc_device_tree; /* @@ -44,7 +58,7 @@ static int property_read_proc(char *page, char **start, off_t off, /* * Process a node, adding entries for its children and its properties. */ -static void add_node(struct device_node *np, struct proc_dir_entry *de) +void proc_device_tree_add_node(struct device_node *np, struct proc_dir_entry *de) { struct property *pp; struct proc_dir_entry *ent; @@ -53,6 +67,7 @@ static void add_node(struct device_node *np, struct proc_dir_entry *de) int l; struct proc_dir_entry *list, **lastp, *al; + set_node_proc_entry(np, de); lastp = &list; for (pp = np->properties; pp != 0; pp = pp->next) { /* @@ -70,7 +85,8 @@ static void add_node(struct device_node *np, struct proc_dir_entry *de) *lastp = ent; lastp = &ent->next; } - for (child = np->child; child != 0; child = child->sibling) { + child = NULL; + while ((child = of_get_next_child(np, child))) { p = strrchr(child->full_name, '/'); if (p == 0) p = child->full_name; @@ -85,7 +101,7 @@ static void add_node(struct device_node *np, struct proc_dir_entry *de) break; *lastp = ent; lastp = &ent->next; - add_node(child, ent); + proc_device_tree_add_node(child, ent); /* * If we left the address part on the name, consider @@ -98,26 +114,32 @@ static void add_node(struct device_node *np, struct proc_dir_entry *de) * If this is the first node with a given name property, * add a symlink with the name property as its name. */ - for (sib = np->child; sib != child; sib = sib->sibling) + sib = NULL; + while ((sib = of_get_next_child(np, sib)) && sib != child) if (sib->name && strcmp(sib->name, child->name) == 0) break; if (sib == child && strncmp(p, child->name, l) != 0) { al = proc_symlink(child->name, de, ent->name); - if (al == 0) + if (al == 0) { + of_node_put(sib); break; + } + set_node_name_link(child, al); *lastp = al; lastp = &al->next; } - + of_node_put(sib); /* * Add another directory with the @address part as its name. */ al = proc_symlink(at, de, ent->name); if (al == 0) break; + set_node_addr_link(child, al); *lastp = al; lastp = &al->next; } + of_node_put(child); *lastp = 0; de->subdir = list; } @@ -133,10 +155,11 @@ void proc_device_tree_init(void) proc_device_tree = proc_mkdir("device-tree", 0); if (proc_device_tree == 0) return; - root = find_path_device("/"); + root = of_find_node_by_path("/"); if (root == 0) { printk(KERN_ERR "/proc/device-tree: can't find root\n"); return; } - add_node(root, proc_device_tree); + proc_device_tree_add_node(root, proc_device_tree); + of_node_put(root); } diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index d8de4a1b03ef..34d372d04622 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -132,6 +132,7 @@ extern void proc_tty_unregister_driver(struct tty_driver *driver); * proc_devtree.c */ extern void proc_device_tree_init(void); +extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); /* * proc_rtas.c |
