]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sparc: Move of_set_property_mutex acquisition outside of devtree_lock grab.
authorDavid S. Miller <davem@davemloft.net>
Mon, 9 Nov 2009 01:41:20 +0000 (17:41 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 8 Dec 2009 18:22:04 +0000 (10:22 -0800)
[ Upstream commit 1c9d80ddc60f8ac26344ec3db9830e5f8016c16d ]

Otherwise we try to sleep with preemption disabled, etc.

Noticed by Thomas Gleixner.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/sparc/kernel/prom_common.c

index 0fb5789d43c82e84977757251ad78a6fa834d9b5..7b4adbc63b4cee722e56d2f5f038700187cbd3d4 100644 (file)
@@ -76,6 +76,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) {
@@ -85,9 +86,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) {
@@ -106,6 +105,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... */