aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries/hotplug-memory.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@linaro.org>2014-11-24 12:58:01 -0500
committerGrant Likely <grant.likely@linaro.org>2014-11-24 17:25:03 -0500
commitf5242e5a883bf1c1aba6bfd87b85e7dda0e62191 (patch)
treeff348e70ad50d96de50212f9a6e6b6088bb7feef /arch/powerpc/platforms/pseries/hotplug-memory.c
parent00aa37206e1a54dae61a0dba96bf2ee0938b99d7 (diff)
of/reconfig: Always use the same structure for notifiers
The OF_RECONFIG notifier callback uses a different structure depending on whether it is a node change or a property change. This is silly, and not very safe. Rework the code to use the same data structure regardless of the type of notifier. Signed-off-by: Grant Likely <grant.likely@linaro.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Rob Herring <robh+dt@kernel.org> Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Cc: <linuxppc-dev@lists.ozlabs.org>
Diffstat (limited to 'arch/powerpc/platforms/pseries/hotplug-memory.c')
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 3c4c0dcd90d3..1bbb78fab530 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -183,7 +183,7 @@ static int pseries_add_mem_node(struct device_node *np)
183 return (ret < 0) ? -EINVAL : 0; 183 return (ret < 0) ? -EINVAL : 0;
184} 184}
185 185
186static int pseries_update_drconf_memory(struct of_prop_reconfig *pr) 186static int pseries_update_drconf_memory(struct of_reconfig_data *pr)
187{ 187{
188 struct of_drconf_cell *new_drmem, *old_drmem; 188 struct of_drconf_cell *new_drmem, *old_drmem;
189 unsigned long memblock_size; 189 unsigned long memblock_size;
@@ -232,22 +232,21 @@ static int pseries_update_drconf_memory(struct of_prop_reconfig *pr)
232} 232}
233 233
234static int pseries_memory_notifier(struct notifier_block *nb, 234static int pseries_memory_notifier(struct notifier_block *nb,
235 unsigned long action, void *node) 235 unsigned long action, void *data)
236{ 236{
237 struct of_prop_reconfig *pr; 237 struct of_reconfig_data *rd = data;
238 int err = 0; 238 int err = 0;
239 239
240 switch (action) { 240 switch (action) {
241 case OF_RECONFIG_ATTACH_NODE: 241 case OF_RECONFIG_ATTACH_NODE:
242 err = pseries_add_mem_node(node); 242 err = pseries_add_mem_node(rd->dn);
243 break; 243 break;
244 case OF_RECONFIG_DETACH_NODE: 244 case OF_RECONFIG_DETACH_NODE:
245 err = pseries_remove_mem_node(node); 245 err = pseries_remove_mem_node(rd->dn);
246 break; 246 break;
247 case OF_RECONFIG_UPDATE_PROPERTY: 247 case OF_RECONFIG_UPDATE_PROPERTY:
248 pr = (struct of_prop_reconfig *)node; 248 if (!strcmp(rd->prop->name, "ibm,dynamic-memory"))
249 if (!strcmp(pr->prop->name, "ibm,dynamic-memory")) 249 err = pseries_update_drconf_memory(rd);
250 err = pseries_update_drconf_memory(pr);
251 break; 250 break;
252 } 251 }
253 return notifier_from_errno(err); 252 return notifier_from_errno(err);