From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753423AbaFXNzo (ORCPT ); Tue, 24 Jun 2014 09:55:44 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:61407 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752521AbaFXNzm (ORCPT ); Tue, 24 Jun 2014 09:55:42 -0400 From: Grant Likely Subject: Re: [PATCH 2/6] OF: Add [__]of_find_node_by_full_name To: Pantelis Antoniou , Guenter Roeck Cc: Rob Herring , Stephen Warren , Matt Porter , Koen Kooi , Greg Kroah-Hartman , Alison Chaiken , Dinh Nguyen , Jan Lubbe , Alexander Sverdlin , Michael Stickel , Dirk Behme , Alan Tull , Sascha Hauer , Michael Bohan , Ionut Nicu , Michal Simek , Matt Ranostay , Joel Becker , devicetree@vger.kernel.org, Wolfram Sang , linux-i2c@vger.kernel.org, Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Pete Popov , Dan Malek , Georgi Vlaev In-Reply-To: <4F4A55EC-744B-49CC-96FA-811C9483A43D@konsulko.com> References: <1403430039-15085-1-git-send-email-pantelis.antoniou@konsulko.com> <1403430039-15085-3-git-send-email-pantelis.antoniou@konsulko.com> <53A86ADA.9000903@roeck-us.net> <4F4A55EC-744B-49CC-96FA-811C9483A43D@konsulko.com> Date: Tue, 24 Jun 2014 14:55:23 +0100 Message-Id: <20140624135523.99956C40B84@trevor.secretlab.ca> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 23 Jun 2014 21:00:39 +0300, Pantelis Antoniou wrote: > Hi Guenter, > > On Jun 23, 2014, at 8:58 PM, Guenter Roeck wrote: > > > On 06/22/2014 02:40 AM, Pantelis Antoniou wrote: > >> __of_find_node_by_full_name recursively searches for a matching node > >> with the given full name without taking any locks. > >> > >> of_find_node_by_full_name takes locks and takes a reference on the > >> matching node. > >> > >> Signed-off-by: Pantelis Antoniou > >> --- > >> drivers/of/base.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ > >> include/linux/of.h | 4 ++++ > >> 2 files changed, 62 insertions(+) > >> > >> diff --git a/drivers/of/base.c b/drivers/of/base.c > >> index d3493e1..80fef33 100644 > >> --- a/drivers/of/base.c > >> +++ b/drivers/of/base.c > >> @@ -1201,6 +1201,64 @@ static void *of_find_property_value_of_size(const struct device_node *np, > >> } > >> > >> /** > >> + * __of_find_node_by_full_name - Find a node with the full name recursively > >> + * @node: Root of the tree to perform the search > >> + * @full_name: Full name of the node to find. > >> + * > >> + * Find a node with the give full name by recursively following any of > >> + * the child node links. > >> + * Returns the matching node, or NULL if not found. > >> + * Note that the devtree lock is not taken, so this function is only > >> + * safe to call on either detached trees, or when devtree lock is already > >> + * taken. > >> + */ > >> +struct device_node *__of_find_node_by_full_name(struct device_node *node, > >> + const char *full_name) > >> +{ > >> + struct device_node *child, *found; > >> + > >> + if (node == NULL) > >> + return NULL; > >> + > >> + /* check */ > >> + if (of_node_cmp(node->full_name, full_name) == 0) > >> + return node; > >> + > >> + __for_each_child_of_node(node, child) { > >> + found = __of_find_node_by_full_name(child, full_name); > >> + if (found != NULL) > >> + return found; > >> + } > >> + > >> + return NULL; > >> +} > >> +EXPORT_SYMBOL(__of_find_node_by_full_name); > >> + > >> +/** > >> + * of_find_node_by_full_name - Find a node with the full name recursively > >> + * @node: Root of the tree to perform the search > >> + * @full_name: Full name of the node to find. > >> + * > >> + * Find a node with the give full name by recursively following any of > >> + * the child node links. > >> + * Returns the matching node (with a ref taken), or NULL if not found. > >> + */ > >> +struct device_node *of_find_node_by_full_name(struct device_node *node, > >> + const char *full_name) > >> +{ > >> + unsigned long flags; > >> + struct device_node *np; > >> + > >> + raw_spin_lock_irqsave(&devtree_lock, flags); > >> + np = of_find_node_by_full_name(node, full_name); > > > > Should this be __of_find_node_by_full_name, or am I missing something ? > > > > Ugh, you're not missing something. This slipped through since this is not > used in the current code Then perhaps the function shouldn't exist at all. g. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Likely Subject: Re: [PATCH 2/6] OF: Add [__]of_find_node_by_full_name Date: Tue, 24 Jun 2014 14:55:23 +0100 Message-ID: <20140624135523.99956C40B84@trevor.secretlab.ca> References: <1403430039-15085-1-git-send-email-pantelis.antoniou@konsulko.com> <1403430039-15085-3-git-send-email-pantelis.antoniou@konsulko.com> <53A86ADA.9000903@roeck-us.net> <4F4A55EC-744B-49CC-96FA-811C9483A43D@konsulko.com> Return-path: In-Reply-To: <4F4A55EC-744B-49CC-96FA-811C9483A43D-OWPKS81ov/FWk0Htik3J/w@public.gmane.org> Sender: linux-spi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Pantelis Antoniou , Guenter Roeck Cc: Rob Herring , Stephen Warren , Matt Porter , Koen Kooi , Greg Kroah-Hartman , Alison Chaiken , Dinh Nguyen , Jan Lubbe , Alexander Sverdlin , Michael Stickel , Dirk Behme , Alan Tull , Sascha Hauer , Michael Bohan , Ionut Nicu , Michal Simek , Matt Ranostay , Joel Becker , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Wolfram Sang , linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Mark Brown , linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pete List-Id: devicetree@vger.kernel.org On Mon, 23 Jun 2014 21:00:39 +0300, Pantelis Antoniou wrote: > Hi Guenter, > > On Jun 23, 2014, at 8:58 PM, Guenter Roeck wrote: > > > On 06/22/2014 02:40 AM, Pantelis Antoniou wrote: > >> __of_find_node_by_full_name recursively searches for a matching node > >> with the given full name without taking any locks. > >> > >> of_find_node_by_full_name takes locks and takes a reference on the > >> matching node. > >> > >> Signed-off-by: Pantelis Antoniou > >> --- > >> drivers/of/base.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ > >> include/linux/of.h | 4 ++++ > >> 2 files changed, 62 insertions(+) > >> > >> diff --git a/drivers/of/base.c b/drivers/of/base.c > >> index d3493e1..80fef33 100644 > >> --- a/drivers/of/base.c > >> +++ b/drivers/of/base.c > >> @@ -1201,6 +1201,64 @@ static void *of_find_property_value_of_size(const struct device_node *np, > >> } > >> > >> /** > >> + * __of_find_node_by_full_name - Find a node with the full name recursively > >> + * @node: Root of the tree to perform the search > >> + * @full_name: Full name of the node to find. > >> + * > >> + * Find a node with the give full name by recursively following any of > >> + * the child node links. > >> + * Returns the matching node, or NULL if not found. > >> + * Note that the devtree lock is not taken, so this function is only > >> + * safe to call on either detached trees, or when devtree lock is already > >> + * taken. > >> + */ > >> +struct device_node *__of_find_node_by_full_name(struct device_node *node, > >> + const char *full_name) > >> +{ > >> + struct device_node *child, *found; > >> + > >> + if (node == NULL) > >> + return NULL; > >> + > >> + /* check */ > >> + if (of_node_cmp(node->full_name, full_name) == 0) > >> + return node; > >> + > >> + __for_each_child_of_node(node, child) { > >> + found = __of_find_node_by_full_name(child, full_name); > >> + if (found != NULL) > >> + return found; > >> + } > >> + > >> + return NULL; > >> +} > >> +EXPORT_SYMBOL(__of_find_node_by_full_name); > >> + > >> +/** > >> + * of_find_node_by_full_name - Find a node with the full name recursively > >> + * @node: Root of the tree to perform the search > >> + * @full_name: Full name of the node to find. > >> + * > >> + * Find a node with the give full name by recursively following any of > >> + * the child node links. > >> + * Returns the matching node (with a ref taken), or NULL if not found. > >> + */ > >> +struct device_node *of_find_node_by_full_name(struct device_node *node, > >> + const char *full_name) > >> +{ > >> + unsigned long flags; > >> + struct device_node *np; > >> + > >> + raw_spin_lock_irqsave(&devtree_lock, flags); > >> + np = of_find_node_by_full_name(node, full_name); > > > > Should this be __of_find_node_by_full_name, or am I missing something ? > > > > Ugh, you're not missing something. This slipped through since this is not > used in the current code Then perhaps the function shouldn't exist at all. g. -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Likely Subject: Re: [PATCH 2/6] OF: Add [__]of_find_node_by_full_name Date: Tue, 24 Jun 2014 14:55:23 +0100 Message-ID: <20140624135523.99956C40B84@trevor.secretlab.ca> References: <1403430039-15085-1-git-send-email-pantelis.antoniou@konsulko.com> <1403430039-15085-3-git-send-email-pantelis.antoniou@konsulko.com> <53A86ADA.9000903@roeck-us.net> <4F4A55EC-744B-49CC-96FA-811C9483A43D@konsulko.com> Cc: Rob Herring , Stephen Warren , Matt Porter , Koen Kooi , Greg Kroah-Hartman , Alison Chaiken , Dinh Nguyen , Jan Lubbe , Alexander Sverdlin , Michael Stickel , Dirk Behme , Alan Tull , Sascha Hauer , Michael Bohan , Ionut Nicu , Michal Simek , Matt Ranostay , Joel Becker , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Wolfram Sang , linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Mark Brown , linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pete Po To: Pantelis Antoniou , Guenter Roeck Return-path: In-Reply-To: <4F4A55EC-744B-49CC-96FA-811C9483A43D-OWPKS81ov/FWk0Htik3J/w@public.gmane.org> Sender: linux-spi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: On Mon, 23 Jun 2014 21:00:39 +0300, Pantelis Antoniou wrote: > Hi Guenter, > > On Jun 23, 2014, at 8:58 PM, Guenter Roeck wrote: > > > On 06/22/2014 02:40 AM, Pantelis Antoniou wrote: > >> __of_find_node_by_full_name recursively searches for a matching node > >> with the given full name without taking any locks. > >> > >> of_find_node_by_full_name takes locks and takes a reference on the > >> matching node. > >> > >> Signed-off-by: Pantelis Antoniou > >> --- > >> drivers/of/base.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ > >> include/linux/of.h | 4 ++++ > >> 2 files changed, 62 insertions(+) > >> > >> diff --git a/drivers/of/base.c b/drivers/of/base.c > >> index d3493e1..80fef33 100644 > >> --- a/drivers/of/base.c > >> +++ b/drivers/of/base.c > >> @@ -1201,6 +1201,64 @@ static void *of_find_property_value_of_size(const struct device_node *np, > >> } > >> > >> /** > >> + * __of_find_node_by_full_name - Find a node with the full name recursively > >> + * @node: Root of the tree to perform the search > >> + * @full_name: Full name of the node to find. > >> + * > >> + * Find a node with the give full name by recursively following any of > >> + * the child node links. > >> + * Returns the matching node, or NULL if not found. > >> + * Note that the devtree lock is not taken, so this function is only > >> + * safe to call on either detached trees, or when devtree lock is already > >> + * taken. > >> + */ > >> +struct device_node *__of_find_node_by_full_name(struct device_node *node, > >> + const char *full_name) > >> +{ > >> + struct device_node *child, *found; > >> + > >> + if (node == NULL) > >> + return NULL; > >> + > >> + /* check */ > >> + if (of_node_cmp(node->full_name, full_name) == 0) > >> + return node; > >> + > >> + __for_each_child_of_node(node, child) { > >> + found = __of_find_node_by_full_name(child, full_name); > >> + if (found != NULL) > >> + return found; > >> + } > >> + > >> + return NULL; > >> +} > >> +EXPORT_SYMBOL(__of_find_node_by_full_name); > >> + > >> +/** > >> + * of_find_node_by_full_name - Find a node with the full name recursively > >> + * @node: Root of the tree to perform the search > >> + * @full_name: Full name of the node to find. > >> + * > >> + * Find a node with the give full name by recursively following any of > >> + * the child node links. > >> + * Returns the matching node (with a ref taken), or NULL if not found. > >> + */ > >> +struct device_node *of_find_node_by_full_name(struct device_node *node, > >> + const char *full_name) > >> +{ > >> + unsigned long flags; > >> + struct device_node *np; > >> + > >> + raw_spin_lock_irqsave(&devtree_lock, flags); > >> + np = of_find_node_by_full_name(node, full_name); > > > > Should this be __of_find_node_by_full_name, or am I missing something ? > > > > Ugh, you're not missing something. This slipped through since this is not > used in the current code Then perhaps the function shouldn't exist at all. g. -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html