aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorNathan Fontenot <nfont@linux.vnet.ibm.com>2012-10-02 12:55:01 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-11-14 17:43:54 -0500
commite81b3295bc54eb0d03f4cdfc8cbf72e731d1b402 (patch)
tree562c84116ff9b969512347a6ffd326fdfe3a9592 /arch/powerpc/platforms
parent83dac59409387789b88bed40b1be86a8abc572be (diff)
powerpc+of: Add /proc device tree updating to of node add/remove
When adding or removing a device tree node we should also update the device tree in /proc/device-tree. This action is already done in the generic OF code for adding/removing properties of a node. This patch adds this functionality for nodes. Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> Acked-by: Rob Herring <rob.herring@calxeda.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/pseries/dlpar.c24
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c47
2 files changed, 0 insertions, 71 deletions
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 0f1b706506ed..e36789bd4e6c 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -13,7 +13,6 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/kref.h> 14#include <linux/kref.h>
15#include <linux/notifier.h> 15#include <linux/notifier.h>
16#include <linux/proc_fs.h>
17#include <linux/spinlock.h> 16#include <linux/spinlock.h>
18#include <linux/cpu.h> 17#include <linux/cpu.h>
19#include <linux/slab.h> 18#include <linux/slab.h>
@@ -255,9 +254,6 @@ static struct device_node *derive_parent(const char *path)
255 254
256int dlpar_attach_node(struct device_node *dn) 255int dlpar_attach_node(struct device_node *dn)
257{ 256{
258#ifdef CONFIG_PROC_DEVICETREE
259 struct proc_dir_entry *ent;
260#endif
261 int rc; 257 int rc;
262 258
263 of_node_set_flag(dn, OF_DYNAMIC); 259 of_node_set_flag(dn, OF_DYNAMIC);
@@ -274,32 +270,12 @@ int dlpar_attach_node(struct device_node *dn)
274 } 270 }
275 271
276 of_attach_node(dn); 272 of_attach_node(dn);
277
278#ifdef CONFIG_PROC_DEVICETREE
279 ent = proc_mkdir(strrchr(dn->full_name, '/') + 1, dn->parent->pde);
280 if (ent)
281 proc_device_tree_add_node(dn, ent);
282#endif
283
284 of_node_put(dn->parent); 273 of_node_put(dn->parent);
285 return 0; 274 return 0;
286} 275}
287 276
288int dlpar_detach_node(struct device_node *dn) 277int dlpar_detach_node(struct device_node *dn)
289{ 278{
290#ifdef CONFIG_PROC_DEVICETREE
291 struct device_node *parent = dn->parent;
292 struct property *prop = dn->properties;
293
294 while (prop) {
295 remove_proc_entry(prop->name, dn->pde);
296 prop = prop->next;
297 }
298
299 if (dn->pde)
300 remove_proc_entry(dn->pde->name, parent->pde);
301#endif
302
303 pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, dn); 279 pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, dn);
304 of_detach_node(dn); 280 of_detach_node(dn);
305 of_node_put(dn); /* Must decrement the refcount */ 281 of_node_put(dn); /* Must decrement the refcount */
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 39f71fba9b38..f99f1ca8035b 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -23,48 +23,6 @@
23#include <asm/pSeries_reconfig.h> 23#include <asm/pSeries_reconfig.h>
24#include <asm/mmu.h> 24#include <asm/mmu.h>
25 25
26
27
28/*
29 * Routines for "runtime" addition and removal of device tree nodes.
30 */
31#ifdef CONFIG_PROC_DEVICETREE
32/*
33 * Add a node to /proc/device-tree.
34 */
35static void add_node_proc_entries(struct device_node *np)
36{
37 struct proc_dir_entry *ent;
38
39 ent = proc_mkdir(strrchr(np->full_name, '/') + 1, np->parent->pde);
40 if (ent)
41 proc_device_tree_add_node(np, ent);
42}
43
44static void remove_node_proc_entries(struct device_node *np)
45{
46 struct property *pp = np->properties;
47 struct device_node *parent = np->parent;
48
49 while (pp) {
50 remove_proc_entry(pp->name, np->pde);
51 pp = pp->next;
52 }
53 if (np->pde)
54 remove_proc_entry(np->pde->name, parent->pde);
55}
56#else /* !CONFIG_PROC_DEVICETREE */
57static void add_node_proc_entries(struct device_node *np)
58{
59 return;
60}
61
62static void remove_node_proc_entries(struct device_node *np)
63{
64 return;
65}
66#endif /* CONFIG_PROC_DEVICETREE */
67
68/** 26/**
69 * derive_parent - basically like dirname(1) 27 * derive_parent - basically like dirname(1)
70 * @path: the full_name of a node to be added to the tree 28 * @path: the full_name of a node to be added to the tree
@@ -149,9 +107,6 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
149 } 107 }
150 108
151 of_attach_node(np); 109 of_attach_node(np);
152
153 add_node_proc_entries(np);
154
155 of_node_put(np->parent); 110 of_node_put(np->parent);
156 111
157 return 0; 112 return 0;
@@ -179,8 +134,6 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
179 return -EBUSY; 134 return -EBUSY;
180 } 135 }
181 136
182 remove_node_proc_entries(np);
183
184 pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, np); 137 pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, np);
185 of_detach_node(np); 138 of_detach_node(np);
186 139