aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/prom.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-06-22 19:18:54 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-06-24 02:15:26 -0400
commitde8d28b16f5614aeb12bb69c8f9a38578b8d3ada (patch)
tree152f0930dc099606342e9cc6d9a3892cd9f3f192 /arch/sparc64/kernel/prom.c
parent765b5f32730cfd2608291e679060b0391570c8b3 (diff)
[SPARC64]: Convert sparc64 PCI layer to in-kernel device tree.
One thing this change pointed out was that we really should pull the "get 'local-mac-address' property" logic into a helper function all the network drivers can call. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/prom.c')
-rw-r--r--arch/sparc64/kernel/prom.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index 0a32b1064dfb..fb112c3c0485 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -20,6 +20,7 @@
20#include <linux/string.h> 20#include <linux/string.h>
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/bootmem.h> 22#include <linux/bootmem.h>
23#include <linux/module.h>
23 24
24#include <asm/prom.h> 25#include <asm/prom.h>
25#include <asm/oplib.h> 26#include <asm/oplib.h>
@@ -63,6 +64,17 @@ struct device_node *of_find_node_by_path(const char *path)
63 return np; 64 return np;
64} 65}
65 66
67struct device_node *of_find_node_by_phandle(phandle handle)
68{
69 struct device_node *np;
70
71 for (np = allnodes; np != 0; np = np->allnext)
72 if (np->node == handle)
73 break;
74
75 return np;
76}
77
66struct device_node *of_find_node_by_name(struct device_node *from, 78struct device_node *of_find_node_by_name(struct device_node *from,
67 const char *name) 79 const char *name)
68{ 80{
@@ -103,6 +115,18 @@ struct property *of_find_property(struct device_node *np, const char *name,
103 } 115 }
104 return pp; 116 return pp;
105} 117}
118EXPORT_SYMBOL(of_find_property);
119
120/*
121 * Find a property with a given name for a given node
122 * and return the value.
123 */
124void *of_get_property(struct device_node *np, const char *name, int *lenp)
125{
126 struct property *pp = of_find_property(np,name,lenp);
127 return pp ? pp->value : NULL;
128}
129EXPORT_SYMBOL(of_get_property);
106 130
107int of_getintprop_default(struct device_node *np, const char *name, int def) 131int of_getintprop_default(struct device_node *np, const char *name, int def)
108{ 132{
@@ -115,6 +139,7 @@ int of_getintprop_default(struct device_node *np, const char *name, int def)
115 139
116 return *(int *) prop->value; 140 return *(int *) prop->value;
117} 141}
142EXPORT_SYMBOL(of_getintprop_default);
118 143
119static unsigned int prom_early_allocated; 144static unsigned int prom_early_allocated;
120 145