devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: "Kumar, Anil" <anilkumar.v@ti.com>
Cc: Alsa Devel List <alsa-devel@alsa-project.org>,
	"devicetree-discuss@lists.ozlabs.org"
	<devicetree-discuss@lists.ozlabs.org>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"jarkko.nikula@bitmer.com" <jarkko.nikula@bitmer.com>
Subject: Re: Use of of_parse_phandle()/of_node_put()
Date: Wed, 13 Feb 2013 16:52:34 +0100	[thread overview]
Message-ID: <511BB6C2.3060105@ti.com> (raw)
In-Reply-To: <F3DBB1B3EF102E4994C89758CFCA32412C6E52@DBDE01.ent.ti.com>

On 02/13/2013 07:04 AM, Kumar, Anil wrote:
> 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 ?

Hrm, one thing or sure we should not call it of_node_put() while we have the
card loaded since the node is used runtime by the core.

However when we unload the machine driver it might be needed, but not sure
about this. None of the existing machine drivers doing it (tegra, samsung,
omap, etc).
But if it is needed it might be better to be done by the core?

>  
> I am taking reference of Linux-next kernel.
>  
> I'm sorry if this question is very vague or  missing something.
>  
> Thanks,
> Anil
>  
>  
>  
>  
>  
>  


-- 
Péter

  reply	other threads:[~2013-02-13 15:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-13  6:04 Use of of_parse_phandle()/of_node_put() Kumar, Anil
2013-02-13 15:52 ` Peter Ujfalusi [this message]
2013-02-13 16:40   ` Anil Kumar
2013-02-13 17:02     ` Anil Kumar
2013-02-14  9:26       ` Peter Ujfalusi
2013-02-14  9:21     ` Peter Ujfalusi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=511BB6C2.3060105@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=anilkumar.v@ti.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=jarkko.nikula@bitmer.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).