From: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: "Karicheri, Muralidharan" <m-karicheri2-l0cyMroinI0@public.gmane.org>
Cc: "devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"
<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] of: add of_find_child_by_name implementation
Date: Sun, 16 Sep 2012 18:58:17 -0500 [thread overview]
Message-ID: <50566799.3090507@gmail.com> (raw)
In-Reply-To: <3E54258959B69E4282D79E01AB1F32B7041CB0CC-GR6MelrUkc+IQmiDNMet8wC/G2K4zDHf@public.gmane.org>
On 09/16/2012 05:24 PM, Karicheri, Muralidharan wrote:
>>> -----Original Message-----
>>> From: Karicheri, Muralidharan
>>> Sent: Thursday, August 30, 2012 11:42 AM
>>> To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org; rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org; devicetree-
>>> discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>> Cc: Karicheri, Muralidharan; Chemparathy, Cyril
>>> Subject: [PATCH] of: add of_find_child_by_name implementation
>>>
>>> This patch adds a helper to find a child node by name.
>>>
>>> Signed-off-by: Cyril Chemparathy <cyril-l0cyMroinI0@public.gmane.org>
>>> Signed-off-by: Murali Karicheri <m-karicheri2-l0cyMroinI0@public.gmane.org>
>>> ---
>>> drivers/of/base.c | 20 ++++++++++++++++++++
>>> include/linux/of.h | 2 ++
>>> 2 files changed, 22 insertions(+)
>>>
>>> diff --git a/drivers/of/base.c b/drivers/of/base.c
>>> index d4a1c9a..bbdd0d4 100644
>>> --- a/drivers/of/base.c
>>> +++ b/drivers/of/base.c
>>> @@ -441,6 +441,26 @@ struct device_node *of_find_node_by_name(struct
>>> device_node *from,
>>> EXPORT_SYMBOL(of_find_node_by_name);
>>>
>>> /**
>>> + * of_find_child_by_name - Find a child node by its "name" property
>>> + * @parent:The parent node to search from
>>> + * @name: The name string to match against
>>> + *
>>> + * Returns a node pointer with refcount incremented, use
>>> + * of_node_put() on it when done.
>>> + */
>>> +struct device_node *of_find_child_by_name(struct device_node *parent,
>>> + const char *name)
>>> +{
>>> + struct device_node *child;
>>> +
>>> + for_each_child_of_node(parent, child)
>>> + if (child->name && of_node_cmp(child->name, name) == 0)
>>> + break;
>>> + return child;
>>> +}
>>> +EXPORT_SYMBOL(of_find_child_by_name);
>>> +
>>> +/**
>>> * of_find_node_by_type - Find a node by its "device_type" property
>>> * @from: The node to start searching from, or NULL to start searching
>>> * the entire device tree. The node you pass will not be
>>> diff --git a/include/linux/of.h b/include/linux/of.h
>>> index 1b11632..a4cc8e7 100644
>>> --- a/include/linux/of.h
>>> +++ b/include/linux/of.h
>>> @@ -193,6 +193,8 @@ extern struct device_node *of_get_next_child(const struct
>>> device_node *node,
>>> extern struct device_node *of_get_next_available_child(
>>> const struct device_node *node, struct device_node *prev);
>>>
>>> +struct device_node *of_find_child_by_name(struct device_node *parent,
>>> + const char *name);
>>> #define for_each_child_of_node(parent, child) \
>>> for (child = of_get_next_child(parent, NULL); child != NULL; \
>>> child = of_get_next_child(parent, child))
>>> --
>>> 1.7.9.5
>
> Can someone review this? If this is okay, can this be merged to the next branch please?
>
This one does the same thing:
http://www.mail-archive.com/devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org/msg18585.html
Yours came first, but this one also converts several places to use it.
So I plan to merge it once subsystem maintainers ack the conversions.
Do you have something for 3.7 dependent on this?
Rob
WARNING: multiple messages have this Message-ID (diff)
From: Rob Herring <robherring2@gmail.com>
To: "Karicheri, Muralidharan" <m-karicheri2@ti.com>
Cc: "grant.likely@secretlab.ca" <grant.likely@secretlab.ca>,
"devicetree-discuss@lists.ozlabs.org"
<devicetree-discuss@lists.ozlabs.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Chemparathy, Cyril" <cyril@ti.com>,
Srinivas KANDAGATLA <srinivas.kandagatla@st.com>
Subject: Re: [PATCH] of: add of_find_child_by_name implementation
Date: Sun, 16 Sep 2012 18:58:17 -0500 [thread overview]
Message-ID: <50566799.3090507@gmail.com> (raw)
In-Reply-To: <3E54258959B69E4282D79E01AB1F32B7041CB0CC@DFLE12.ent.ti.com>
On 09/16/2012 05:24 PM, Karicheri, Muralidharan wrote:
>>> -----Original Message-----
>>> From: Karicheri, Muralidharan
>>> Sent: Thursday, August 30, 2012 11:42 AM
>>> To: grant.likely@secretlab.ca; rob.herring@calxeda.com; devicetree-
>>> discuss@lists.ozlabs.org; linux-kernel@vger.kernel.org
>>> Cc: Karicheri, Muralidharan; Chemparathy, Cyril
>>> Subject: [PATCH] of: add of_find_child_by_name implementation
>>>
>>> This patch adds a helper to find a child node by name.
>>>
>>> Signed-off-by: Cyril Chemparathy <cyril@ti.com>
>>> Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
>>> ---
>>> drivers/of/base.c | 20 ++++++++++++++++++++
>>> include/linux/of.h | 2 ++
>>> 2 files changed, 22 insertions(+)
>>>
>>> diff --git a/drivers/of/base.c b/drivers/of/base.c
>>> index d4a1c9a..bbdd0d4 100644
>>> --- a/drivers/of/base.c
>>> +++ b/drivers/of/base.c
>>> @@ -441,6 +441,26 @@ struct device_node *of_find_node_by_name(struct
>>> device_node *from,
>>> EXPORT_SYMBOL(of_find_node_by_name);
>>>
>>> /**
>>> + * of_find_child_by_name - Find a child node by its "name" property
>>> + * @parent:The parent node to search from
>>> + * @name: The name string to match against
>>> + *
>>> + * Returns a node pointer with refcount incremented, use
>>> + * of_node_put() on it when done.
>>> + */
>>> +struct device_node *of_find_child_by_name(struct device_node *parent,
>>> + const char *name)
>>> +{
>>> + struct device_node *child;
>>> +
>>> + for_each_child_of_node(parent, child)
>>> + if (child->name && of_node_cmp(child->name, name) == 0)
>>> + break;
>>> + return child;
>>> +}
>>> +EXPORT_SYMBOL(of_find_child_by_name);
>>> +
>>> +/**
>>> * of_find_node_by_type - Find a node by its "device_type" property
>>> * @from: The node to start searching from, or NULL to start searching
>>> * the entire device tree. The node you pass will not be
>>> diff --git a/include/linux/of.h b/include/linux/of.h
>>> index 1b11632..a4cc8e7 100644
>>> --- a/include/linux/of.h
>>> +++ b/include/linux/of.h
>>> @@ -193,6 +193,8 @@ extern struct device_node *of_get_next_child(const struct
>>> device_node *node,
>>> extern struct device_node *of_get_next_available_child(
>>> const struct device_node *node, struct device_node *prev);
>>>
>>> +struct device_node *of_find_child_by_name(struct device_node *parent,
>>> + const char *name);
>>> #define for_each_child_of_node(parent, child) \
>>> for (child = of_get_next_child(parent, NULL); child != NULL; \
>>> child = of_get_next_child(parent, child))
>>> --
>>> 1.7.9.5
>
> Can someone review this? If this is okay, can this be merged to the next branch please?
>
This one does the same thing:
http://www.mail-archive.com/devicetree-discuss@lists.ozlabs.org/msg18585.html
Yours came first, but this one also converts several places to use it.
So I plan to merge it once subsystem maintainers ack the conversions.
Do you have something for 3.7 dependent on this?
Rob
next prev parent reply other threads:[~2012-09-16 23:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1346341328-23554-1-git-send-email-m-karicheri2@ti.com>
2012-09-16 22:24 ` [PATCH] of: add of_find_child_by_name implementation Karicheri, Muralidharan
[not found] ` <3E54258959B69E4282D79E01AB1F32B7041CB0CC-GR6MelrUkc+IQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-09-16 23:58 ` Rob Herring [this message]
2012-09-16 23:58 ` Rob Herring
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=50566799.3090507@gmail.com \
--to=robherring2-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=m-karicheri2-l0cyMroinI0@public.gmane.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 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.