On Wed, 2009-03-18 at 23:00 -0600, Grant Likely wrote:
quoted hunk ↗ jump to hunk
From: Grant Likely <redacted>
of_parse_phandle() is a helper function to read and parse a phandle
property and return a pointer to the resulting device_node.
Signed-off-by: Grant Likely <redacted>
---
drivers/of/base.c | 23 +++++++++++++++++++++++
include/linux/of.h | 3 +++
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index cd17092..1eaada4 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -494,6 +494,29 @@ int of_modalias_node(struct device_node *node, char *modalias, int len)
EXPORT_SYMBOL_GPL(of_modalias_node);
/**
+ * of_parse_phandle - Resolve a phandle property to a device_node pointer
+ * @np: Pointer to device node holding phandle property
+ * @phandle_name: Name of property holding a phandle value
+ * @index: For properties holding a table of phandles, this is the index into
+ * the table
+ *
+ * Returns the device_node pointer pointed to by the phandle, or NULL
+ */
I think it would good to follow the convention of many of the other of_
routines and have an explicit comment about the refcounting, eg:
* Returns a node pointer with refcount incremented, use
* of_node_put() on it when done.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person