]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/sparc/kernel/prom.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[linux-2.6-omap-h63xx.git] / arch / sparc / kernel / prom.c
index e3a537650db1e8792c0d7a7978b0e52ab3e7fe2e..eee5efcfe50eea300a42d43e887bf4a7b5a54c6a 100644 (file)
@@ -54,6 +54,9 @@ int of_getintprop_default(struct device_node *np, const char *name, int def)
 }
 EXPORT_SYMBOL(of_getintprop_default);
 
+DEFINE_MUTEX(of_set_property_mutex);
+EXPORT_SYMBOL(of_set_property_mutex);
+
 int of_set_property(struct device_node *dp, const char *name, void *val, int len)
 {
        struct property **prevp;
@@ -77,7 +80,10 @@ 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, (char *) name, val, len);
+                       mutex_unlock(&of_set_property_mutex);
+
                        err = -EINVAL;
                        if (ret >= 0) {
                                prop->value = new_val;
@@ -102,6 +108,21 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
 }
 EXPORT_SYMBOL(of_set_property);
 
+int of_find_in_proplist(const char *list, const char *match, int len)
+{
+       while (len > 0) {
+               int l;
+
+               if (!strcmp(list, match))
+                       return 1;
+               l = strlen(list) + 1;
+               list += l;
+               len -= l;
+       }
+       return 0;
+}
+EXPORT_SYMBOL(of_find_in_proplist);
+
 static unsigned int prom_early_allocated;
 
 static void * __init prom_early_alloc(unsigned long size)
@@ -415,13 +436,12 @@ static void __init of_console_init(void)
        unsigned long flags;
        const char *type;
        phandle node;
-       int skip, fd;
+       int skip, tmp, fd;
 
        of_console_path = prom_early_alloc(256);
 
        switch (prom_vers) {
        case PROM_V0:
-       case PROM_SUN4:
                skip = 0;
                switch (*romvec->pv_stdout) {
                case PROMDEV_SCREEN:
@@ -442,8 +462,9 @@ static void __init of_console_init(void)
                        prom_halt();
                }
 
+               tmp = skip;
                for_each_node_by_type(dp, type) {
-                       if (!skip--)
+                       if (!tmp--)
                                break;
                }
                if (!dp) {