From: Philipp Zabel <p.zabel@pengutronix.de>
To: Grant Likely <grant.likely@linaro.org>,
Mauro Carvalho Chehab <m.chehab@samsung.com>,
Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Rob Herring <robh+dt@kernel.org>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
devicetree@vger.kernel.org,
Philipp Zabel <p.zabel@pengutronix.de>
Subject: [PATCH v5 4/7] of: Reduce indentation in of_graph_get_next_endpoint
Date: Thu, 27 Feb 2014 18:35:37 +0100 [thread overview]
Message-ID: <1393522540-22887-5-git-send-email-p.zabel@pengutronix.de> (raw)
In-Reply-To: <1393522540-22887-1-git-send-email-p.zabel@pengutronix.de>
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@pengutronix.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 6e650cf..8ecca7a 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 has no parent node\n",
- __func__))
- 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 has no parent node\n",
+ __func__))
+ 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);
--
1.8.5.3
next prev parent reply other threads:[~2014-02-27 17:35 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-27 17:35 [PATCH v5 0/7] Move device tree graph parsing helpers to drivers/of Philipp Zabel
2014-02-27 17:35 ` [PATCH v5 1/7] [media] of: move graph helpers from drivers/media/v4l2-core " Philipp Zabel
[not found] ` <1393522540-22887-1-git-send-email-p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-02-27 17:35 ` [PATCH v5 2/7] Documentation: of: Document graph bindings Philipp Zabel
2014-02-28 21:08 ` Sylwester Nawrocki
2014-03-04 10:16 ` Philipp Zabel
2014-02-27 17:35 ` [PATCH v5 3/7] of: Warn if of_graph_get_next_endpoint is called with the root node Philipp Zabel
2014-02-28 21:09 ` Sylwester Nawrocki
2014-03-04 10:12 ` Philipp Zabel
2014-02-27 17:35 ` Philipp Zabel [this message]
2014-02-27 17:35 ` [PATCH v5 5/7] [media] of: move common endpoint parsing to drivers/of Philipp Zabel
2014-02-28 21:09 ` Sylwester Nawrocki
2014-03-04 10:09 ` Philipp Zabel
[not found] ` <1393522540-22887-6-git-send-email-p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-03-04 8:58 ` Tomi Valkeinen
2014-03-04 11:36 ` Philipp Zabel
2014-03-04 12:21 ` Tomi Valkeinen
2014-03-04 15:47 ` Philipp Zabel
[not found] ` <1393948056.3917.120.camel-+qGW7pzALmz7o/J7KWpOmN53zsg1cpMQ@public.gmane.org>
2014-03-05 10:05 ` Tomi Valkeinen
[not found] ` <5315C535.2070303-l0cyMroinI0@public.gmane.org>
2014-03-06 23:59 ` Laurent Pinchart
2014-03-07 0:06 ` Eric Boxer
2014-02-27 17:35 ` [PATCH v5 6/7] of: Implement simplified graph binding for single port devices Philipp Zabel
2014-03-04 9:06 ` Tomi Valkeinen
2014-03-04 10:04 ` Philipp Zabel
2014-02-27 17:35 ` [PATCH v5 7/7] of: Document " Philipp Zabel
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=1393522540-22887-5-git-send-email-p.zabel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=devicetree@vger.kernel.org \
--cc=g.liakhovetski@gmx.de \
--cc=grant.likely@linaro.org \
--cc=kyungmin.park@samsung.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=m.chehab@samsung.com \
--cc=robh+dt@kernel.org \
--cc=s.nawrocki@samsung.com \
--cc=tomi.valkeinen@ti.com \
/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 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).