From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Grant Likely <grant.likely@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Pawel Moll <pawel.moll@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>
Cc: Linux LED Subsystem <linux-leds@vger.kernel.org>,
Sakari Ailus <sakari.ailus@iki.fi>, Bryan Wu <cooloney@gmail.com>
Subject: Re: LED subsystem child DT node ref counting
Date: Mon, 27 Apr 2015 11:26:27 +0200 [thread overview]
Message-ID: <553E00C3.3060409@samsung.com> (raw)
In-Reply-To: <5530E891.20707@samsung.com>
Gentle reminder. Can anyone clarify this?
On 04/17/2015 01:03 PM, Jacek Anaszewski wrote:
> Hi,
>
> I'd like to clarify whether LED subsystem drivers behave correctly
> or not, regarding child DT nodes reference counting.
>
> Single LED controller can have connected more then one LED to it.
> The LEDs are represented by child DT nodes of the node representing
> the controller (see Documentation/devicetree/bindings/leds).
>
> LED subsystem drivers parse child DT nodes and use the node name,
> or 'label' property string as the LED class device name.
>
> This is usually accomplished like below:
>
> for_each_child_of_node(np, child) {
> ...
> led.name = of_get_property(child, "label", NULL) ? : child->name;
>
>
> The question is whether reference count of the child node shouldn't
> be increased here with of_node_get(child). Whereas intuitively it could
> be thought of as a right thing to do, empirical experiments don't
> necessary confirm that.
>
> When I print the value of child_node->kobj.kref.refcount.counter
> inside for_each loop it is 3 and and after leaving the loop it gets
> decreased to 2. On driver removal the value is also 2. It means that
> label is available all the time, without increasing child node ref
> counter.
>
> I'd like to ask if this is guaranteed to be always true.
>
--
Best Regards,
Jacek Anaszewski
next prev parent reply other threads:[~2015-04-27 9:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 11:03 LED subsystem child DT node ref counting Jacek Anaszewski
2015-04-27 9:26 ` Jacek Anaszewski [this message]
2015-04-27 13:57 ` Rob Herring
2015-04-28 7:15 ` Jacek Anaszewski
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=553E00C3.3060409@samsung.com \
--to=j.anaszewski@samsung.com \
--cc=cooloney@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=grant.likely@linaro.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-leds@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=sakari.ailus@iki.fi \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.