* RE: [PATCH] of: add of_find_child_by_name implementation [not found] <1346341328-23554-1-git-send-email-m-karicheri2@ti.com> @ 2012-09-16 22:24 ` Karicheri, Muralidharan [not found] ` <3E54258959B69E4282D79E01AB1F32B7041CB0CC-GR6MelrUkc+IQmiDNMet8wC/G2K4zDHf@public.gmane.org> 0 siblings, 1 reply; 2+ messages in thread From: Karicheri, Muralidharan @ 2012-09-16 22:24 UTC (permalink / raw) To: Karicheri, Muralidharan, grant.likely@secretlab.ca, rob.herring@calxeda.com, devicetree-discuss@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: Chemparathy, Cyril >> -----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? Murali ^ permalink raw reply [flat|nested] 2+ messages in thread
[parent not found: <3E54258959B69E4282D79E01AB1F32B7041CB0CC-GR6MelrUkc+IQmiDNMet8wC/G2K4zDHf@public.gmane.org>]
* Re: [PATCH] of: add of_find_child_by_name implementation [not found] ` <3E54258959B69E4282D79E01AB1F32B7041CB0CC-GR6MelrUkc+IQmiDNMet8wC/G2K4zDHf@public.gmane.org> @ 2012-09-16 23:58 ` Rob Herring 0 siblings, 0 replies; 2+ messages in thread From: Rob Herring @ 2012-09-16 23:58 UTC (permalink / raw) To: Karicheri, Muralidharan Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@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 ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-16 23:58 UTC | newest] Thread overview: 2+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [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 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).