summaryrefslogtreecommitdiff
path: root/arch/powerpc/boot/libfdt-wrapper.c
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2008-01-24 22:41:05 -0600
committerKumar Gala <galak@kernel.crashing.org>2008-01-27 14:07:37 -0600
commitb3bea15d29799797d1486aeddf883404a2e05c81 (patch)
treed8ddcaa66e27a0b367d50c9d32e389c41d580322 /arch/powerpc/boot/libfdt-wrapper.c
parent03a16b27bd30f22d88f570585551925248469f84 (diff)
[POWERPC] bootwrapper: Add find_node_by_compatible
Add the ability to find a device node by just what its compatible with. This is useful in cases that we don't have a prop to find the node with. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/boot/libfdt-wrapper.c')
-rw-r--r--arch/powerpc/boot/libfdt-wrapper.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/powerpc/boot/libfdt-wrapper.c b/arch/powerpc/boot/libfdt-wrapper.c
index 97af36c224bd..59016bef1391 100644
--- a/arch/powerpc/boot/libfdt-wrapper.c
+++ b/arch/powerpc/boot/libfdt-wrapper.c
@@ -133,6 +133,14 @@ static void *fdt_wrapper_find_node_by_prop_value(const void *prev,
return offset_devp(offset);
}
+static void *fdt_wrapper_find_node_by_compatible(const void *prev,
+ const char *val)
+{
+ int offset = fdt_node_offset_by_compatible(fdt, devp_offset_find(prev),
+ val);
+ return offset_devp(offset);
+}
+
static char *fdt_wrapper_get_path(const void *devp, char *buf, int len)
{
int rc;
@@ -164,6 +172,7 @@ void fdt_init(void *blob)
dt_ops.get_parent = fdt_wrapper_get_parent;
dt_ops.create_node = fdt_wrapper_create_node;
dt_ops.find_node_by_prop_value = fdt_wrapper_find_node_by_prop_value;
+ dt_ops.find_node_by_compatible = fdt_wrapper_find_node_by_compatible;
dt_ops.get_path = fdt_wrapper_get_path;
dt_ops.finalize = fdt_wrapper_finalize;