[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>
This commit is contained in:
David S. Miller
2006-06-22 16:18:54 -07:00
parent 765b5f3273
commit de8d28b16f
17 changed files with 180 additions and 132 deletions

View File

@@ -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;