[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <31687163.hgTkcLrn0Z@avalon>
Date: Fri, 07 Mar 2014 01:12:37 +0100
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Philipp Zabel <p.zabel@...gutronix.de>
Cc: Grant Likely <grant.likely@...aro.org>,
Mauro Carvalho Chehab <m.chehab@...sung.com>,
Russell King - ARM Linux <linux@....linux.org.uk>,
Rob Herring <robh+dt@...nel.org>,
Sylwester Nawrocki <s.nawrocki@...sung.com>,
Guennadi Liakhovetski <g.liakhovetski@....de>,
Tomi Valkeinen <tomi.valkeinen@...com>,
Kyungmin Park <kyungmin.park@...sung.com>,
linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
devicetree@...r.kernel.org
Subject: Re: [PATCH v6 4/8] of: Reduce indentation in of_graph_get_next_endpoint
Hi Philipp,
Thank you for the patch.
I've submitted a fix for the of_graph_get_next_endpoint() function, but it
hasn't been applied yet due to the patch series that contained it needing more
work.
The patch is available at https://patchwork.linuxtv.org/patch/21946/. I can
rebase it on top of this series, but I still wanted to let you know about it
in case you would like to integrate it.
On Wednesday 05 March 2014 10:20:38 Philipp Zabel wrote:
> A 'return endpoint;' at the end of the (!prev) case allows to
> reduce the indentation level of the (prev) case.
>
> Signed-off-by: Philipp Zabel <p.zabel@...gutronix.de>
> ---
> drivers/of/base.c | 42 ++++++++++++++++++++++--------------------
> 1 file changed, 22 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index b5e690b..a8e47d3 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -2026,32 +2026,34 @@ struct device_node *of_graph_get_next_endpoint(const
> struct device_node *parent, pr_err("%s(): no endpoint nodes specified for
> %s\n",
> __func__, parent->full_name);
> of_node_put(node);
> - } else {
> - port = of_get_parent(prev);
> - if (WARN_ONCE(!port, "%s(): endpoint %s has no parent node\n",
> - __func__, prev->full_name))
> - return NULL;
>
> - /* Avoid dropping prev node refcount to 0. */
> - of_node_get(prev);
> - endpoint = of_get_next_child(port, prev);
> - if (endpoint) {
> - of_node_put(port);
> - return endpoint;
> - }
> + return endpoint;
> + }
>
> - /* No more endpoints under this port, try the next one. */
> - do {
> - port = of_get_next_child(parent, port);
> - if (!port)
> - return NULL;
> - } while (of_node_cmp(port->name, "port"));
> + port = of_get_parent(prev);
> + if (WARN_ONCE(!port, "%s(): endpoint %s has no parent node\n",
> + __func__, prev->full_name))
> + return NULL;
>
> - /* Pick up the first endpoint in this port. */
> - endpoint = of_get_next_child(port, NULL);
> + /* Avoid dropping prev node refcount to 0. */
> + of_node_get(prev);
> + endpoint = of_get_next_child(port, prev);
> + if (endpoint) {
> of_node_put(port);
> + return endpoint;
> }
>
> + /* No more endpoints under this port, try the next one. */
> + do {
> + port = of_get_next_child(parent, port);
> + if (!port)
> + return NULL;
> + } while (of_node_cmp(port->name, "port"));
> +
> + /* Pick up the first endpoint in this port. */
> + endpoint = of_get_next_child(port, NULL);
> + of_node_put(port);
> +
> return endpoint;
> }
> EXPORT_SYMBOL(of_graph_get_next_endpoint);
--
Regards,
Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists