sparc: Move 'unique_id' into prom_common.c and rename to 'prom_unique_id'
[deliverable/linux.git] / arch / sparc / kernel / prom_32.c
index eee5efcfe50eea300a42d43e887bf4a7b5a54c6a..c34888a21b2d6cc7f4e6b22ae5f65c0556e84385 100644 (file)
 #include <asm/prom.h>
 #include <asm/oplib.h>
 
-extern struct device_node *allnodes;   /* temporary while merging */
-
-extern rwlock_t devtree_lock;  /* temporary while merging */
-
-struct device_node *of_find_node_by_phandle(phandle handle)
-{
-       struct device_node *np;
-
-       for (np = allnodes; np != 0; np = np->allnext)
-               if (np->node == handle)
-                       break;
-
-       return np;
-}
-EXPORT_SYMBOL(of_find_node_by_phandle);
-
-int of_getintprop_default(struct device_node *np, const char *name, int def)
-{
-       struct property *prop;
-       int len;
-
-       prop = of_find_property(np, name, &len);
-       if (!prop || len != 4)
-               return def;
-
-       return *(int *) prop->value;
-}
-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;
-       void *new_val;
-       int err;
-
-       new_val = kmalloc(len, GFP_KERNEL);
-       if (!new_val)
-               return -ENOMEM;
-
-       memcpy(new_val, val, len);
-
-       err = -ENODEV;
-
-       write_lock(&devtree_lock);
-       prevp = &dp->properties;
-       while (*prevp) {
-               struct property *prop = *prevp;
-
-               if (!strcasecmp(prop->name, name)) {
-                       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;
-                               prop->length = len;
-
-                               if (OF_IS_DYNAMIC(prop))
-                                       kfree(old_val);
-
-                               OF_MARK_DYNAMIC(prop);
-
-                               err = 0;
-                       }
-                       break;
-               }
-               prevp = &(*prevp)->next;
-       }
-       write_unlock(&devtree_lock);
-
-       /* XXX Upate procfs if necessary... */
-
-       return err;
-}
-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);
+#include "prom.h"
 
 static unsigned int prom_early_allocated;
 
-static void * __init prom_early_alloc(unsigned long size)
+void * __init prom_early_alloc(unsigned long size)
 {
        void *ret;
 
@@ -292,8 +196,6 @@ static char * __init build_full_name(struct device_node *dp)
        return n;
 }
 
-static unsigned int unique_id;
-
 static struct property * __init build_one_prop(phandle node, char *prev, char *special_name, void *special_val, int special_len)
 {
        static struct property *tmp = NULL;
@@ -307,7 +209,7 @@ static struct property * __init build_one_prop(phandle node, char *prev, char *s
                tmp = NULL;
        } else {
                p = prom_early_alloc(sizeof(struct property) + 32);
-               p->unique_id = unique_id++;
+               p->unique_id = prom_unique_id++;
        }
 
        p->name = (char *) (p + 1);
@@ -382,7 +284,7 @@ static struct device_node * __init create_node(phandle node)
                return NULL;
 
        dp = prom_early_alloc(sizeof(*dp));
-       dp->unique_id = unique_id++;
+       dp->unique_id = prom_unique_id++;
 
        kref_init(&dp->kref);
 
This page took 0.02784 seconds and 5 git commands to generate.