of: merge of_find_node_by_phandle
authorJeremy Kerr <jeremy.kerr@canonical.com>
Tue, 2 Feb 2010 04:34:11 +0000 (21:34 -0700)
committerGrant Likely <grant.likely@secretlab.ca>
Tue, 9 Feb 2010 15:32:48 +0000 (08:32 -0700)
Merge common function between powerpc, sparc and microblaze. Code is
identical for powerpc and microblaze, but adds a lock (and release) of
the devtree_lock on sparc.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
arch/microblaze/kernel/prom.c
arch/powerpc/kernel/prom.c
arch/sparc/kernel/prom_common.c
drivers/of/base.c

index 8171282a0b0d555d5f382a91f70bc468765bdc9e..f7bd0ee8d481c5f9917412e03c3751cc8a1e45f5 100644 (file)
@@ -176,27 +176,6 @@ void __init early_init_devtree(void *params)
  *
  *******/
 
-/**
- *     of_find_node_by_phandle - Find a node given a phandle
- *     @handle:        phandle of the node to find
- *
- *     Returns a node pointer with refcount incremented, use
- *     of_node_put() on it when done.
- */
-struct device_node *of_find_node_by_phandle(phandle handle)
-{
-       struct device_node *np;
-
-       read_lock(&devtree_lock);
-       for (np = allnodes; np != NULL; np = np->allnext)
-               if (np->phandle == handle)
-                       break;
-       of_node_get(np);
-       read_unlock(&devtree_lock);
-       return np;
-}
-EXPORT_SYMBOL(of_find_node_by_phandle);
-
 #if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
 static struct debugfs_blob_wrapper flat_dt_blob;
 
index f954c718d7eb7f8cee9830fcf97f005a0a403c53..28be19ab0f182f53d26a0cc019bad897f3a756fe 100644 (file)
@@ -765,27 +765,6 @@ void __init early_init_devtree(void *params)
  *
  *******/
 
-/**
- *     of_find_node_by_phandle - Find a node given a phandle
- *     @handle:        phandle of the node to find
- *
- *     Returns a node pointer with refcount incremented, use
- *     of_node_put() on it when done.
- */
-struct device_node *of_find_node_by_phandle(phandle handle)
-{
-       struct device_node *np;
-
-       read_lock(&devtree_lock);
-       for (np = allnodes; np != 0; np = np->allnext)
-               if (np->phandle == handle)
-                       break;
-       of_node_get(np);
-       read_unlock(&devtree_lock);
-       return np;
-}
-EXPORT_SYMBOL(of_find_node_by_phandle);
-
 /**
  *     of_find_next_cache_node - Find a node's subsidiary cache
  *     @np:    node of type "cpu" or "cache"
index 5832e13dfeeba9c3123e7dba17b7f4d8c0da6c2a..57ac9e28be0caff3b08be55f0228fa8655863739 100644 (file)
@@ -37,18 +37,6 @@ EXPORT_SYMBOL(of_console_path);
 char *of_console_options;
 EXPORT_SYMBOL(of_console_options);
 
-struct device_node *of_find_node_by_phandle(phandle handle)
-{
-       struct device_node *np;
-
-       for (np = allnodes; np; np = np->allnext)
-               if (np->phandle == 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;
index 2ce58be314afd5d6a000ca6df0f9058ba0c0b80b..785e9cc1b20797ab0925b0c3cd16ef0f1f17026b 100644 (file)
@@ -614,6 +614,27 @@ int of_modalias_node(struct device_node *node, char *modalias, int len)
 }
 EXPORT_SYMBOL_GPL(of_modalias_node);
 
+/**
+ * of_find_node_by_phandle - Find a node given a phandle
+ * @handle:    phandle of the node to find
+ *
+ * Returns a node pointer with refcount incremented, use
+ * of_node_put() on it when done.
+ */
+struct device_node *of_find_node_by_phandle(phandle handle)
+{
+       struct device_node *np;
+
+       read_lock(&devtree_lock);
+       for (np = allnodes; np; np = np->allnext)
+               if (np->phandle == handle)
+                       break;
+       of_node_get(np);
+       read_unlock(&devtree_lock);
+       return np;
+}
+EXPORT_SYMBOL(of_find_node_by_phandle);
+
 /**
  * of_parse_phandle - Resolve a phandle property to a device_node pointer
  * @np: Pointer to device node holding phandle property