aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2011-06-20 23:35:55 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-06-29 03:48:22 -0400
commit3aef19f0a10d1c274a15191766b627fe550d456e (patch)
treec3731b65f9263626a03200eb2fce8db50095bb67 /arch/powerpc/platforms/pseries
parente48f7eb27f0e38e1a461fa4e43025d18100d250b (diff)
powerpc/pseries: Introduce pSeries_reconfig_notify()
This introduces pSeries_reconfig_notify() as a just wrapper of blocking_notifier_call_chain() for pSeries_reconfig_chain. This is a preparation to improvement of error code on reconfiguration notifier failure. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/pseries')
-rw-r--r--arch/powerpc/platforms/pseries/dlpar.c10
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c30
2 files changed, 22 insertions, 18 deletions
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 57ceb92b2288..e9be25bc571b 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -262,12 +262,11 @@ int dlpar_attach_node(struct device_node *dn)
262 if (!dn->parent) 262 if (!dn->parent)
263 return -ENOMEM; 263 return -ENOMEM;
264 264
265 rc = blocking_notifier_call_chain(&pSeries_reconfig_chain, 265 rc = pSeries_reconfig_notify(PSERIES_RECONFIG_ADD, dn);
266 PSERIES_RECONFIG_ADD, dn); 266 if (rc) {
267 if (rc == NOTIFY_BAD) {
268 printk(KERN_ERR "Failed to add device node %s\n", 267 printk(KERN_ERR "Failed to add device node %s\n",
269 dn->full_name); 268 dn->full_name);
270 return -ENOMEM; /* For now, safe to assume kmalloc failure */ 269 return rc;
271 } 270 }
272 271
273 of_attach_node(dn); 272 of_attach_node(dn);
@@ -297,8 +296,7 @@ int dlpar_detach_node(struct device_node *dn)
297 remove_proc_entry(dn->pde->name, parent->pde); 296 remove_proc_entry(dn->pde->name, parent->pde);
298#endif 297#endif
299 298
300 blocking_notifier_call_chain(&pSeries_reconfig_chain, 299 pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, dn);
301 PSERIES_RECONFIG_REMOVE, dn);
302 of_detach_node(dn); 300 of_detach_node(dn);
303 of_node_put(dn); /* Must decrement the refcount */ 301 of_node_put(dn); /* Must decrement the refcount */
304 302
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 1de2cbb92303..286b6af3d55d 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -97,7 +97,7 @@ static struct device_node *derive_parent(const char *path)
97 return parent; 97 return parent;
98} 98}
99 99
100BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain); 100static BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain);
101 101
102int pSeries_reconfig_notifier_register(struct notifier_block *nb) 102int pSeries_reconfig_notifier_register(struct notifier_block *nb)
103{ 103{
@@ -109,6 +109,16 @@ void pSeries_reconfig_notifier_unregister(struct notifier_block *nb)
109 blocking_notifier_chain_unregister(&pSeries_reconfig_chain, nb); 109 blocking_notifier_chain_unregister(&pSeries_reconfig_chain, nb);
110} 110}
111 111
112int pSeries_reconfig_notify(unsigned long action, void *p)
113{
114 int err = blocking_notifier_call_chain(&pSeries_reconfig_chain,
115 action, p);
116
117 if (err == NOTIFY_BAD)
118 return -ENOMEM; /* For now, safe to assume kmalloc failure */
119 return 0;
120}
121
112static int pSeries_reconfig_add_node(const char *path, struct property *proplist) 122static int pSeries_reconfig_add_node(const char *path, struct property *proplist)
113{ 123{
114 struct device_node *np; 124 struct device_node *np;
@@ -132,11 +142,9 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
132 goto out_err; 142 goto out_err;
133 } 143 }
134 144
135 err = blocking_notifier_call_chain(&pSeries_reconfig_chain, 145 err = pSeries_reconfig_notify(PSERIES_RECONFIG_ADD, np);
136 PSERIES_RECONFIG_ADD, np); 146 if (err) {
137 if (err == NOTIFY_BAD) {
138 printk(KERN_ERR "Failed to add device node %s\n", path); 147 printk(KERN_ERR "Failed to add device node %s\n", path);
139 err = -ENOMEM; /* For now, safe to assume kmalloc failure */
140 goto out_err; 148 goto out_err;
141 } 149 }
142 150
@@ -173,8 +181,7 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
173 181
174 remove_node_proc_entries(np); 182 remove_node_proc_entries(np);
175 183
176 blocking_notifier_call_chain(&pSeries_reconfig_chain, 184 pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, np);
177 PSERIES_RECONFIG_REMOVE, np);
178 of_detach_node(np); 185 of_detach_node(np);
179 186
180 of_node_put(parent); 187 of_node_put(parent);
@@ -472,11 +479,10 @@ static int do_update_property(char *buf, size_t bufsize)
472 else 479 else
473 action = PSERIES_DRCONF_MEM_REMOVE; 480 action = PSERIES_DRCONF_MEM_REMOVE;
474 481
475 rc = blocking_notifier_call_chain(&pSeries_reconfig_chain, 482 rc = pSeries_reconfig_notify(action, value);
476 action, value); 483 if (rc) {
477 if (rc == NOTIFY_BAD) { 484 prom_update_property(np, oldprop, newprop);
478 rc = prom_update_property(np, oldprop, newprop); 485 return rc;
479 return -ENOMEM;
480 } 486 }
481 } 487 }
482 488