From: Michael Ellerman <michael@ellerman.id.au>
To: Scott Wood <scottwood@freescale.com>
Cc: devicetree-discuss@ozlabs.org, linuxppc-dev@lists.ozlabs.org,
Deepak Saxena <deepak_saxena@mentor.com>
Subject: Re: [PATCH 3/5] of/device: Make of_get_next_child() check status properties
Date: Thu, 09 Dec 2010 12:33:22 +1100 [thread overview]
Message-ID: <1291858402.2962.2.camel@concordia> (raw)
In-Reply-To: <20101208150102.69b8062b@udp111988uds.am.freescale.net>
[-- Attachment #1: Type: text/plain, Size: 2048 bytes --]
On Wed, 2010-12-08 at 15:01 -0600, Scott Wood wrote:
> On Wed, 8 Dec 2010 11:29:44 -0800
> Deepak Saxena <deepak_saxena@mentor.com> wrote:
>
> > We only return the next child if the device is available.
> >
> > Signed-off-by: Hollis Blanchard <hollis_blanchard@mentor.com>
> > Signed-off-by: Deepak Saxena <deepak_saxena@mentor.com>
> > ---
> > drivers/of/base.c | 4 +++-
> > 1 files changed, 3 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/of/base.c b/drivers/of/base.c
> > index 5d269a4..81b2601 100644
> > --- a/drivers/of/base.c
> > +++ b/drivers/of/base.c
> > @@ -321,6 +321,8 @@ struct device_node *of_get_next_parent(struct device_node *node)
> > *
> > * Returns a node pointer with refcount incremented, use
> > * of_node_put() on it when done.
> > + *
> > + * Does not return nodes marked unavailable by a status property.
> > */
> > struct device_node *of_get_next_child(const struct device_node *node,
> > struct device_node *prev)
> > @@ -330,7 +332,7 @@ struct device_node *of_get_next_child(const struct device_node *node,
> > read_lock(&devtree_lock);
> > next = prev ? prev->sibling : node->child;
> > for (; next; next = next->sibling)
> > - if (of_node_get(next))
> > + if (of_device_is_available(next) && of_node_get(next))
> > break;
> > of_node_put(prev);
> > read_unlock(&devtree_lock);
>
> This seems like too low-level a place to put this. Some code may know
> how to un-disable a device in certain situations, or it may be part of
> debug code trying to dump the whole device tree, etc. Looking
> further[1], I see a raw version of this function, but not other things
> like of_find_compatible_node.
Yeah I agree. I think we'll eventually end up with __ versions of all or
lots of them. Not to mention there might be cases you've missed where
code expects to see unavailable nodes. The right approach is to add
_new_ routines that don't return unavailable nodes, and convert code
that you know wants to use them.
cheers
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2010-12-09 1:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1291799069.git.deepak_saxena@mentor.com>
2010-12-08 19:29 ` [PATCH 1/5] of/device: Centralize checking of 'status' properties Deepak Saxena
2010-12-31 7:43 ` Grant Likely
2010-12-08 19:29 ` [PATCH 4/5] of/device: Create _of_get_next_child() Deepak Saxena
2010-12-08 19:29 ` [PATCH 5/5] of/device: Show even unavailable nodes in procfs Deepak Saxena
2010-12-08 19:29 ` [PATCH 3/5] of/device: Make of_get_next_child() check status properties Deepak Saxena
2010-12-08 21:01 ` Scott Wood
2010-12-09 1:33 ` Michael Ellerman [this message]
2010-12-09 3:09 ` David Gibson
2010-12-15 18:35 ` Hollis Blanchard
2010-12-15 22:40 ` Michael Ellerman
2010-12-31 7:39 ` Grant Likely
2010-12-08 19:29 ` [PATCH 2/5] of/device: make for_each_node* " Deepak Saxena
2010-12-31 7:46 ` Grant Likely
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=1291858402.2962.2.camel@concordia \
--to=michael@ellerman.id.au \
--cc=deepak_saxena@mentor.com \
--cc=devicetree-discuss@ozlabs.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=scottwood@freescale.com \
/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).