[PATCH 6/7] powerpc: add of_find_property function
Dave C Boutcher
sleddog at us.ibm.com
Thu Jan 12 12:31:30 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(-)
diff -uNr 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 18:00:06.000000000 -0600
+++ linux-2.6.15-patched2/arch/powerpc/kernel/prom.c 2006-01-11 18:00:21.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;
@@ -1971,6 +1967,17 @@
}
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 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 18:00:06.000000000 -0600
+++ linux-2.6.15-patched2/include/asm-powerpc/prom.h 2006-01-11 18:00:21.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