diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-06-22 16:18:54 -0700 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-06-23 23:15:26 -0700 |
commit | de8d28b16f5614aeb12bb69c8f9a38578b8d3ada (patch) | |
tree | 152f0930dc099606342e9cc6d9a3892cd9f3f192 /arch/sparc64/kernel/prom.c | |
parent | 765b5f32730cfd2608291e679060b0391570c8b3 (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.c | 25 |
1 files changed, 25 insertions, 0 deletions
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 <linux/string.h> #include <linux/mm.h> #include <linux/bootmem.h> +#include <linux/module.h> #include <asm/prom.h> #include <asm/oplib.h> @@ -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; |