aboutsummaryrefslogtreecommitdiffstats
path: root/arch
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
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')
-rw-r--r--arch/powerpc/mm/numa.c3
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-cpu.c7
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c15
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c5
-rw-r--r--arch/powerpc/platforms/pseries/setup.c5
5 files changed, 18 insertions, 17 deletions
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index b9d1dfdbe5bb..9fe6002c1d5a 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1711,12 +1711,11 @@ static void stage_topology_update(int core_id)
1711static int dt_update_callback(struct notifier_block *nb, 1711static int dt_update_callback(struct notifier_block *nb,
1712 unsigned long action, void *data) 1712 unsigned long action, void *data)
1713{ 1713{
1714 struct of_prop_reconfig *update; 1714 struct of_reconfig_data *update = data;
1715 int rc = NOTIFY_DONE; 1715 int rc = NOTIFY_DONE;
1716 1716
1717 switch (action) { 1717 switch (action) {
1718 case OF_RECONFIG_UPDATE_PROPERTY: 1718 case OF_RECONFIG_UPDATE_PROPERTY:
1719 update = (struct of_prop_reconfig *)data;
1720 if (!of_prop_cmp(update->dn->type, "cpu") && 1719 if (!of_prop_cmp(update->dn->type, "cpu") &&
1721 !of_prop_cmp(update->prop->name, "ibm,associativity")) { 1720 !of_prop_cmp(update->prop->name, "ibm,associativity")) {
1722 u32 core_id; 1721 u32 core_id;
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 5c375f93c669..f30cf4d136a4 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -340,16 +340,17 @@ static void pseries_remove_processor(struct device_node *np)
340} 340}
341 341
342static int pseries_smp_notifier(struct notifier_block *nb, 342static int pseries_smp_notifier(struct notifier_block *nb,
343 unsigned long action, void *node) 343 unsigned long action, void *data)
344{ 344{
345 struct of_reconfig_data *rd = data;
345 int err = 0; 346 int err = 0;
346 347
347 switch (action) { 348 switch (action) {
348 case OF_RECONFIG_ATTACH_NODE: 349 case OF_RECONFIG_ATTACH_NODE:
349 err = pseries_add_processor(node); 350 err = pseries_add_processor(rd->dn);
350 break; 351 break;
351 case OF_RECONFIG_DETACH_NODE: 352 case OF_RECONFIG_DETACH_NODE:
352 pseries_remove_processor(node); 353 pseries_remove_processor(rd->dn);
353 break; 354 break;
354 } 355 }
355 return notifier_from_errno(err); 356 return notifier_from_errno(err);
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);
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index e32e00976a94..3e5bfdafee63 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -1251,10 +1251,11 @@ static struct notifier_block iommu_mem_nb = {
1251 .notifier_call = iommu_mem_notifier, 1251 .notifier_call = iommu_mem_notifier,
1252}; 1252};
1253 1253
1254static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node) 1254static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *data)
1255{ 1255{
1256 int err = NOTIFY_OK; 1256 int err = NOTIFY_OK;
1257 struct device_node *np = node; 1257 struct of_reconfig_data *rd = data;
1258 struct device_node *np = rd->dn;
1258 struct pci_dn *pci = PCI_DN(np); 1259 struct pci_dn *pci = PCI_DN(np);
1259 struct direct_window *window; 1260 struct direct_window *window;
1260 1261
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 125c589eeef5..ed8a90022a3d 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -251,9 +251,10 @@ static void __init pseries_discover_pic(void)
251 " interrupt-controller\n"); 251 " interrupt-controller\n");
252} 252}
253 253
254static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node) 254static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *data)
255{ 255{
256 struct device_node *np = node; 256 struct of_reconfig_data *rd = data;
257 struct device_node *np = rd->dn;
257 struct pci_dn *pci = NULL; 258 struct pci_dn *pci = NULL;
258 int err = NOTIFY_OK; 259 int err = NOTIFY_OK;
259 260