[SPARC64]: Add of_find_node_by_{name,type}().
authorDavid S. Miller <davem@sunset.davemloft.net>
Wed, 21 Jun 2006 23:33:54 +0000 (16:33 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sat, 24 Jun 2006 06:15:04 +0000 (23:15 -0700)
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc64/kernel/prom.c
include/asm-sparc64/prom.h

index c99b7aae19df055403d63c7b239300d95f479fea..fd46e94ce06b114b5dfe708278c5dc29fa8bc17b 100644 (file)
@@ -63,6 +63,32 @@ struct device_node *of_find_node_by_path(const char *path)
        return np;
 }
 
+struct device_node *of_find_node_by_name(struct device_node *from,
+       const char *name)
+{
+       struct device_node *np;
+
+       np = from ? from->allnext : allnodes;
+       for (; np != NULL; np = np->allnext)
+               if (np->name != NULL && strcmp(np->name, name) == 0)
+                       break;
+
+       return np;
+}
+
+struct device_node *of_find_node_by_type(struct device_node *from,
+       const char *type)
+{
+       struct device_node *np;
+
+       np = from ? from->allnext : allnodes;
+       for (; np != 0; np = np->allnext)
+               if (np->type != 0 && strcmp(np->type, type) == 0)
+                       break;
+
+       return np;
+}
+
 struct property *of_find_property(struct device_node *np, const char *name,
                                  int *lenp)
 {
index 44bcc83267f3a3afa6ad39c80f3b41969fd7939d..eb75d3cbcf4cd84ec426d39d104ec0ac9f92074d 100644 (file)
@@ -65,6 +65,16 @@ static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_e
        dn->pde = de;
 }
 
+extern struct device_node *of_find_node_by_name(struct device_node *from,
+       const char *name);
+#define for_each_node_by_name(dn, name) \
+       for (dn = of_find_node_by_name(NULL, name); dn; \
+            dn = of_find_node_by_name(dn, name))
+extern struct device_node *of_find_node_by_type(struct device_node *from,
+       const char *type);
+#define for_each_node_by_type(dn, type) \
+       for (dn = of_find_node_by_type(NULL, type); dn; \
+            dn = of_find_node_by_type(dn, type))
 extern struct device_node *of_find_node_by_path(const char *path);
 extern struct device_node *of_get_parent(const struct device_node *node);
 extern struct device_node *of_get_next_child(const struct device_node *node,
This page took 0.034802 seconds and 5 git commands to generate.