@@ -1902,8 +1902,9 @@ int __of_update_property(struct device_node *np, struct property *newprop,
return 0;
}
+
/*
- * of_update_property - Update a property in a node, if the property does
+ * of_update_property_self - Update a property in a node, if the property does
* not exist, add it.
*
* Note that we don't actually remove it, since we have given out
@@ -1911,7 +1912,7 @@ int __of_update_property(struct device_node *np, struct property *newprop,
* Instead we just move the property to the "dead properties" list,
* and add the new property to the property list
*/
-int of_update_property(struct device_node *np, struct property *newprop)
+int of_update_property_self(struct device_node *np, struct property *newprop, bool self)
{
struct property *oldprop;
unsigned long flags;
@@ -1927,7 +1928,7 @@ int of_update_property(struct device_node *np, struct property *newprop)
raw_spin_unlock_irqrestore(&devtree_lock, flags);
if (!rc)
- __of_update_property_sysfs(np, newprop, oldprop);
+ __of_update_property_sysfs(np, newprop, oldprop, self);
mutex_unlock(&of_mutex);
@@ -652,7 +652,7 @@ static int __of_changeset_entry_apply(struct of_changeset_entry *ce)
__of_remove_property_sysfs(ce->np, ce->prop);
break;
case OF_RECONFIG_UPDATE_PROPERTY:
- __of_update_property_sysfs(ce->np, ce->prop, ce->old_prop);
+ __of_update_property_sysfs(ce->np, ce->prop, ce->old_prop, false);
break;
}
@@ -104,14 +104,14 @@ void __of_remove_property_sysfs(struct device_node *np, struct property *prop)
}
void __of_update_property_sysfs(struct device_node *np, struct property *newprop,
- struct property *oldprop)
+ struct property *oldprop, bool self)
{
/* At early boot, bail out and defer setup to of_init() */
if (!of_kset)
return;
if (oldprop)
- __of_sysfs_remove_bin_file(np, oldprop, false);
+ __of_sysfs_remove_bin_file(np, oldprop, self);
__of_add_property_sysfs(np, newprop);
}
@@ -64,7 +64,7 @@ int of_node_is_attached(struct device_node *node);
int __of_add_property_sysfs(struct device_node *np, struct property *pp);
void __of_remove_property_sysfs(struct device_node *np, struct property *prop);
void __of_update_property_sysfs(struct device_node *np, struct property *newprop,
- struct property *oldprop);
+ struct property *oldprop, bool self);
int __of_attach_node_sysfs(struct device_node *np);
void __of_detach_node_sysfs(struct device_node *np);
#else
@@ -74,7 +74,7 @@ static inline int __of_add_property_sysfs(struct device_node *np, struct propert
}
static inline void __of_remove_property_sysfs(struct device_node *np, struct property *prop) {}
static inline void __of_update_property_sysfs(struct device_node *np,
- struct property *newprop, struct property *oldprop) {}
+ struct property *newprop, struct property *oldprop, bool self) {}
static inline int __of_attach_node_sysfs(struct device_node *np)
{
return 0;
@@ -401,7 +401,12 @@ extern int of_machine_is_compatible(const char *compat);
extern int of_add_property(struct device_node *np, struct property *prop);
extern int of_remove_property(struct device_node *np, struct property *prop);
-extern int of_update_property(struct device_node *np, struct property *newprop);
+extern int of_update_property_self(struct device_node *np, struct property *newprop, bool self);
+
+static inline int of_update_property(struct device_node *np, struct property *newprop)
+{
+ return of_update_property_self(np, newprop, false);
+}
/* For updating the device tree at runtime */
#define OF_RECONFIG_ATTACH_NODE 0x0001
This is to indicate that the property is being updated via its own sysfs method so that we ultimately call into kernfs_remove_self() and avoid the deadlock that would occur otherwise. Signed-off-by: Zev Weiss <zev@bewilderbeest.net> --- drivers/of/base.c | 7 ++++--- drivers/of/dynamic.c | 2 +- drivers/of/kobj.c | 4 ++-- drivers/of/of_private.h | 4 ++-- include/linux/of.h | 7 ++++++- 5 files changed, 15 insertions(+), 9 deletions(-)