Skip to content

Commit

Permalink
sparc: Move of_set_property_mutex acquisition outside of devtree_lock…
Browse files Browse the repository at this point in the history
… grab.

Otherwise we try to sleep with preemption disabled, etc.

Noticed by Thomas Gleixner.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Nov 9, 2009
1 parent 88b938e commit 1c9d80d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/sparc/kernel/prom_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len

err = -ENODEV;

mutex_lock(&of_set_property_mutex);
write_lock(&devtree_lock);
prevp = &dp->properties;
while (*prevp) {
Expand All @@ -88,9 +89,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
void *old_val = prop->value;
int ret;

mutex_lock(&of_set_property_mutex);
ret = prom_setprop(dp->node, name, val, len);
mutex_unlock(&of_set_property_mutex);

err = -EINVAL;
if (ret >= 0) {
Expand All @@ -109,6 +108,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
prevp = &(*prevp)->next;
}
write_unlock(&devtree_lock);
mutex_unlock(&of_set_property_mutex);

/* XXX Upate procfs if necessary... */

Expand Down

0 comments on commit 1c9d80d

Please sign in to comment.