On Wed, 8 Dec 2010 11:29:44 -0800 Deepak Saxena <[email protected]> wrote:
> We only return the next child if the device is available. > > Signed-off-by: Hollis Blanchard <[email protected]> > Signed-off-by: Deepak Saxena <[email protected]> > --- > 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. Could this be done more othogonally, so that the caller specifies in a parameter whether to skip based on status? -Scott [1] For some reason I received some of these patches from linuxppc-dev, and others from devicetree-discuss. I wish lists wouldn't try to be "smart" about discarding duplicates -- it messes with filters. _______________________________________________ devicetree-discuss mailing list [email protected] https://lists.ozlabs.org/listinfo/devicetree-discuss
