[PATCH 4/5] powerpc: add of_find_property function
Dave C Boutcher
sleddog at us.ibm.com
Wed Jan 11 21:03:45 EST 2006
Add an of_find_property function that returns a struct property
given a property name. Then change the get_property function to
use that routine internally.
Signed-off-by: Dave Boutcher <sleddog at us.ibm.com>
arch/powerpc/kernel/prom.c | 19 +++++++++++++------
include/asm-powerpc/prom.h | 3 +++
2 files changed, 16 insertions(+), 6 deletions(-)
Files linux-2.6.15-patched/arch/powerpc/boot/zImage.vmode and linux-2.6.15-patched2/arch/powerpc/boot/zImage.vmode differ
diff -uNr -X exclude-files linux-2.6.15-patched/arch/powerpc/kernel/prom.c linux-2.6.15-patched2/arch/powerpc/kernel/prom.c
--- linux-2.6.15-patched/arch/powerpc/kernel/prom.c 2006-01-11 03:01:45.000000000 -0600
+++ linux-2.6.15-patched2/arch/powerpc/kernel/prom.c 2006-01-11 03:08:00.000000000 -0600
@@ -1953,12 +1953,8 @@
__initcall(prom_reconfig_setup);
#endif
-/*
- * Find a property with a given name for a given node
- * and return the value.
- */
-unsigned char *get_property(struct device_node *np, const char *name,
- int *lenp)
+struct property *of_find_property(struct device_node *np, const char *name,
+ int *lenp)
{
struct property *pp;
@@ -1970,7 +1966,18 @@
break;
}
read_unlock(&devtree_lock);
+
+ return pp;
+}
+/*
+ * Find a property with a given name for a given node
+ * and return the value.
+ */
+unsigned char *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(get_property);
diff -uNr -X exclude-files linux-2.6.15-patched/include/asm-powerpc/prom.h linux-2.6.15-patched2/include/asm-powerpc/prom.h
--- linux-2.6.15-patched/include/asm-powerpc/prom.h 2006-01-11 03:01:45.000000000 -0600
+++ linux-2.6.15-patched2/include/asm-powerpc/prom.h 2006-01-11 03:07:04.000000000 -0600
@@ -176,6 +176,9 @@
extern struct device_node *of_get_parent(const struct device_node *node);
extern struct device_node *of_get_next_child(const struct device_node *node,
struct device_node *prev);
+extern struct property *of_find_property(struct device_node *np,
+ const char *name,
+ int *lenp);
extern struct device_node *of_node_get(struct device_node *node);
extern void of_node_put(struct device_node *node);
--
Dave Boutcher
More information about the Linuxppc64-dev
mailing list