aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorNathan Fontenot <nfont@linux.vnet.ibm.com>2012-10-02 12:57:57 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-11-14 20:56:41 -0500
commit1cf3d8b3d24cd383ddfd5442c83ec5c355ffc2f7 (patch)
tree0f4790e95f917c6b76d95c88b7b3d67445261893 /drivers/crypto
parentf59497208363f3dd9d62b79b7f7eafc95432de79 (diff)
powerpc+of: Add of node/property notification chain for adds and removes
This patch moves the notification chain for updates to the device tree from the powerpc/pseries code to the base OF code. This makes this functionality available to all architectures. Additionally the notification chain is updated to allow notifications for property add/remove/update. To make this work a pointer to a new struct (of_prop_reconfig) is passed to the routines in the notification chain. The of_prop_reconfig property contains a pointer to the node containing the property and a pointer to the property itself. In the case of property updates, the property pointer refers to the new property. 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 'drivers/crypto')
-rw-r--r--drivers/crypto/nx/nx-842.c20
-rw-r--r--drivers/crypto/nx/nx.c1
2 files changed, 8 insertions, 13 deletions
diff --git a/drivers/crypto/nx/nx-842.c b/drivers/crypto/nx/nx-842.c
index 0ce625738677..6c4c000671c5 100644
--- a/drivers/crypto/nx/nx-842.c
+++ b/drivers/crypto/nx/nx-842.c
@@ -28,7 +28,6 @@
28#include <linux/slab.h> 28#include <linux/slab.h>
29 29
30#include <asm/page.h> 30#include <asm/page.h>
31#include <asm/pSeries_reconfig.h>
32#include <asm/vio.h> 31#include <asm/vio.h>
33 32
34#include "nx_csbcpb.h" /* struct nx_csbcpb */ 33#include "nx_csbcpb.h" /* struct nx_csbcpb */
@@ -1014,26 +1013,23 @@ error_out:
1014 * NOTIFY_BAD encoded with error number on failure, use 1013 * NOTIFY_BAD encoded with error number on failure, use
1015 * notifier_to_errno() to decode this value 1014 * notifier_to_errno() to decode this value
1016 */ 1015 */
1017static int nx842_OF_notifier(struct notifier_block *np, 1016static int nx842_OF_notifier(struct notifier_block *np, unsigned long action,
1018 unsigned long action, 1017 void *update)
1019 void *update)
1020{ 1018{
1021 struct pSeries_reconfig_prop_update *upd; 1019 struct of_prop_reconfig *upd = update;
1022 struct nx842_devdata *local_devdata; 1020 struct nx842_devdata *local_devdata;
1023 struct device_node *node = NULL; 1021 struct device_node *node = NULL;
1024 1022
1025 upd = (struct pSeries_reconfig_prop_update *)update;
1026
1027 rcu_read_lock(); 1023 rcu_read_lock();
1028 local_devdata = rcu_dereference(devdata); 1024 local_devdata = rcu_dereference(devdata);
1029 if (local_devdata) 1025 if (local_devdata)
1030 node = local_devdata->dev->of_node; 1026 node = local_devdata->dev->of_node;
1031 1027
1032 if (local_devdata && 1028 if (local_devdata &&
1033 action == PSERIES_UPDATE_PROPERTY && 1029 action == OF_RECONFIG_UPDATE_PROPERTY &&
1034 !strcmp(upd->node->name, node->name)) { 1030 !strcmp(upd->dn->name, node->name)) {
1035 rcu_read_unlock(); 1031 rcu_read_unlock();
1036 nx842_OF_upd(upd->property); 1032 nx842_OF_upd(upd->prop);
1037 } else 1033 } else
1038 rcu_read_unlock(); 1034 rcu_read_unlock();
1039 1035
@@ -1182,7 +1178,7 @@ static int __init nx842_probe(struct vio_dev *viodev,
1182 synchronize_rcu(); 1178 synchronize_rcu();
1183 kfree(old_devdata); 1179 kfree(old_devdata);
1184 1180
1185 pSeries_reconfig_notifier_register(&nx842_of_nb); 1181 of_reconfig_notifier_register(&nx842_of_nb);
1186 1182
1187 ret = nx842_OF_upd(NULL); 1183 ret = nx842_OF_upd(NULL);
1188 if (ret && ret != -ENODEV) { 1184 if (ret && ret != -ENODEV) {
@@ -1228,7 +1224,7 @@ static int __exit nx842_remove(struct vio_dev *viodev)
1228 spin_lock_irqsave(&devdata_mutex, flags); 1224 spin_lock_irqsave(&devdata_mutex, flags);
1229 old_devdata = rcu_dereference_check(devdata, 1225 old_devdata = rcu_dereference_check(devdata,
1230 lockdep_is_held(&devdata_mutex)); 1226 lockdep_is_held(&devdata_mutex));
1231 pSeries_reconfig_notifier_unregister(&nx842_of_nb); 1227 of_reconfig_notifier_unregister(&nx842_of_nb);
1232 rcu_assign_pointer(devdata, NULL); 1228 rcu_assign_pointer(devdata, NULL);
1233 spin_unlock_irqrestore(&devdata_mutex, flags); 1229 spin_unlock_irqrestore(&devdata_mutex, flags);
1234 synchronize_rcu(); 1230 synchronize_rcu();
diff --git a/drivers/crypto/nx/nx.c b/drivers/crypto/nx/nx.c
index 638110efae9b..f7a8a16aa7d3 100644
--- a/drivers/crypto/nx/nx.c
+++ b/drivers/crypto/nx/nx.c
@@ -33,7 +33,6 @@
33#include <linux/scatterlist.h> 33#include <linux/scatterlist.h>
34#include <linux/device.h> 34#include <linux/device.h>
35#include <linux/of.h> 35#include <linux/of.h>
36#include <asm/pSeries_reconfig.h>
37#include <asm/hvcall.h> 36#include <asm/hvcall.h>
38#include <asm/vio.h> 37#include <asm/vio.h>
39 38