summaryrefslogtreecommitdiff
path: root/drivers/of/dynamic.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@linaro.org>2014-07-16 12:48:23 -0600
committerGrant Likely <grant.likely@linaro.org>2014-07-23 17:08:13 -0600
commit259092a35c7e11f1d4616b0f5b3ba7b851fe4fa6 (patch)
tree932489d219e9c07b3a2f1ba37aabf7ed58242b7a /drivers/of/dynamic.c
parenta25095d451ece23b1fef34474f3230100db7aa05 (diff)
of: Reorder device tree changes and notifiers
Currently, devicetree reconfig notifiers get emitted before the change is applied to the tree, but that behaviour is problematic if the receiver wants the determine the new state of the tree. The current users don't care, but the changeset code to follow will be making multiple changes at once. Reorder notifiers to get emitted after the change has been applied to the tree so that callbacks see the new tree state. At the same time, fixup the existing callbacks to expect the new order. There are a few callbacks that compare the old and new values of a changed property. Put both property pointers into the of_prop_reconfig structure. The current notifiers also allow the notifier callback to fail and cancel the change to the tree, but that feature isn't actually used. It really isn't valid to ignore a tree modification provided by firmware anyway, so remove the ability to cancel a change to the tree. Signed-off-by: Grant Likely <grant.likely@linaro.org> Cc: Nathan Fontenot <nfont@austin.ibm.com>
Diffstat (limited to 'drivers/of/dynamic.c')
-rw-r--r--drivers/of/dynamic.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 7c020b9a3317..7bd5501736a6 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -83,7 +83,7 @@ int of_reconfig_notify(unsigned long action, void *p)
}
int of_property_notify(int action, struct device_node *np,
- struct property *prop)
+ struct property *prop, struct property *oldprop)
{
struct of_prop_reconfig pr;
@@ -93,6 +93,7 @@ int of_property_notify(int action, struct device_node *np,
pr.dn = np;
pr.prop = prop;
+ pr.old_prop = oldprop;
return of_reconfig_notify(action, &pr);
}
@@ -125,11 +126,6 @@ void __of_attach_node(struct device_node *np)
int of_attach_node(struct device_node *np)
{
unsigned long flags;
- int rc;
-
- rc = of_reconfig_notify(OF_RECONFIG_ATTACH_NODE, np);
- if (rc)
- return rc;
mutex_lock(&of_mutex);
raw_spin_lock_irqsave(&devtree_lock, flags);
@@ -138,6 +134,9 @@ int of_attach_node(struct device_node *np)
__of_attach_node_sysfs(np);
mutex_unlock(&of_mutex);
+
+ of_reconfig_notify(OF_RECONFIG_ATTACH_NODE, np);
+
return 0;
}
@@ -188,10 +187,6 @@ int of_detach_node(struct device_node *np)
unsigned long flags;
int rc = 0;
- rc = of_reconfig_notify(OF_RECONFIG_DETACH_NODE, np);
- if (rc)
- return rc;
-
mutex_lock(&of_mutex);
raw_spin_lock_irqsave(&devtree_lock, flags);
__of_detach_node(np);
@@ -199,6 +194,9 @@ int of_detach_node(struct device_node *np)
__of_detach_node_sysfs(np);
mutex_unlock(&of_mutex);
+
+ of_reconfig_notify(OF_RECONFIG_DETACH_NODE, np);
+
return rc;
}