From de8d28b16f5614aeb12bb69c8f9a38578b8d3ada Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 22 Jun 2006 16:18:54 -0700 Subject: [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 --- arch/sparc64/kernel/prom.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'arch/sparc64/kernel/prom.c') diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c index 0a32b1064df..fb112c3c048 100644 --- a/arch/sparc64/kernel/prom.c +++ b/arch/sparc64/kernel/prom.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -63,6 +64,17 @@ struct device_node *of_find_node_by_path(const char *path) return np; } +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; +} + struct device_node *of_find_node_by_name(struct device_node *from, const char *name) { @@ -103,6 +115,18 @@ struct property *of_find_property(struct device_node *np, const char *name, } return pp; } +EXPORT_SYMBOL(of_find_property); + +/* + * Find a property with a given name for a given node + * and return the value. + */ +void *of_get_property(struct device_node *np, const char *name, int *lenp) +{ + struct property *pp = of_find_property(np,name,lenp); + return pp ? pp->value : NULL; +} +EXPORT_SYMBOL(of_get_property); int of_getintprop_default(struct device_node *np, const char *name, int def) { @@ -115,6 +139,7 @@ int of_getintprop_default(struct device_node *np, const char *name, int def) return *(int *) prop->value; } +EXPORT_SYMBOL(of_getintprop_default); static unsigned int prom_early_allocated; -- cgit v1.2.3