[PATCH 1/9] of: add of_parse_phandle() helper for parsing phandle properties

Michael Ellerman michael at ellerman.id.au
Thu Mar 19 16:07:50 EST 2009


On Wed, 2009-03-18 at 23:00 -0600, Grant Likely wrote:
> From: Grant Likely <grant.likely at secretlab.ca>
> 
> 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 <grant.likely at secretlab.ca>
> ---
> 
>  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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20090319/59ae8ee2/attachment.pgp>


More information about the Linuxppc-dev mailing list