aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries/reconfig.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/pseries/reconfig.c')
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 1de2cbb92303..168651acdd83 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,14 @@ 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 return notifier_to_errno(err);
118}
119
112static int pSeries_reconfig_add_node(const char *path, struct property *proplist) 120static int pSeries_reconfig_add_node(const char *path, struct property *proplist)
113{ 121{
114 struct device_node *np; 122 struct device_node *np;
@@ -132,11 +140,9 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
132 goto out_err; 140 goto out_err;
133 } 141 }
134 142
135 err = blocking_notifier_call_chain(&pSeries_reconfig_chain, 143 err = pSeries_reconfig_notify(PSERIES_RECONFIG_ADD, np);
136 PSERIES_RECONFIG_ADD, np); 144 if (err) {
137 if (err == NOTIFY_BAD) {
138 printk(KERN_ERR "Failed to add device node %s\n", path); 145 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; 146 goto out_err;
141 } 147 }
142 148
@@ -173,8 +179,7 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
173 179
174 remove_node_proc_entries(np); 180 remove_node_proc_entries(np);
175 181
176 blocking_notifier_call_chain(&pSeries_reconfig_chain, 182 pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, np);
177 PSERIES_RECONFIG_REMOVE, np);
178 of_detach_node(np); 183 of_detach_node(np);
179 184
180 of_node_put(parent); 185 of_node_put(parent);
@@ -472,11 +477,10 @@ static int do_update_property(char *buf, size_t bufsize)
472 else 477 else
473 action = PSERIES_DRCONF_MEM_REMOVE; 478 action = PSERIES_DRCONF_MEM_REMOVE;
474 479
475 rc = blocking_notifier_call_chain(&pSeries_reconfig_chain, 480 rc = pSeries_reconfig_notify(action, value);
476 action, value); 481 if (rc) {
477 if (rc == NOTIFY_BAD) { 482 prom_update_property(np, oldprop, newprop);
478 rc = prom_update_property(np, oldprop, newprop); 483 return rc;
479 return -ENOMEM;
480 } 484 }
481 } 485 }
482 486