Use of of_parse_phandle()/of_node_put()

Kumar, Anil anilkumar.v at ti.com
Wed Feb 13 17:04:35 EST 2013


Hi  Peter,

Just trying to understand.

In omap-twl4030.c file probe function :-

 dai_node = of_parse_phandle(node, "ti,mcbsp", 0);
                if (!dai_node) {
                        dev_err(&pdev->dev, "McBSP node is not provided\n");
                        return -EINVAL;
                }

Here  "of_parse_phandle()"  is used to get  "of_device" node pointer.
of_parse_phandle() suggest to use of_node_put()  on it when done.

It looks when code request for an "of_device" node, kernel  maintains "refcount" for this.
It check "refcount"  before giving pointer of of_device node and  WARN_ON()
in case of refcount  > 0 and increase it on success.

Should this code need to use of_node_put() on the requested "of_device" when done
so that this can be get  again ?

I am taking reference of Linux-next kernel.

I'm sorry if this question is very vague or  missing something.

Thanks,
Anil






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20130213/73d4b5cb/attachment.html>


More information about the devicetree-discuss mailing list