diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2014-02-26 14:43:42 -0500 |
---|---|---|
committer | Philipp Zabel <p.zabel@pengutronix.de> | 2014-03-06 11:41:44 -0500 |
commit | 4329b93b283cce828967c01bc3827fdff51c8d7e (patch) | |
tree | 882e9ca70685c5fec906d148e03ccfe127ac5f67 /drivers/of/base.c | |
parent | 6ff60d397b172bd89955433bd9e74be4627d7b9e (diff) |
of: Reduce indentation in of_graph_get_next_endpoint
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>
Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r-- | drivers/of/base.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index b5e690bd6e9c..a8e47d37cc7f 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, | |||
2026 | pr_err("%s(): no endpoint nodes specified for %s\n", | 2026 | pr_err("%s(): no endpoint nodes specified for %s\n", |
2027 | __func__, parent->full_name); | 2027 | __func__, parent->full_name); |
2028 | of_node_put(node); | 2028 | of_node_put(node); |
2029 | } else { | ||
2030 | port = of_get_parent(prev); | ||
2031 | if (WARN_ONCE(!port, "%s(): endpoint %s has no parent node\n", | ||
2032 | __func__, prev->full_name)) | ||
2033 | return NULL; | ||
2034 | 2029 | ||
2035 | /* Avoid dropping prev node refcount to 0. */ | 2030 | return endpoint; |
2036 | of_node_get(prev); | 2031 | } |
2037 | endpoint = of_get_next_child(port, prev); | ||
2038 | if (endpoint) { | ||
2039 | of_node_put(port); | ||
2040 | return endpoint; | ||
2041 | } | ||
2042 | 2032 | ||
2043 | /* No more endpoints under this port, try the next one. */ | 2033 | port = of_get_parent(prev); |
2044 | do { | 2034 | if (WARN_ONCE(!port, "%s(): endpoint %s has no parent node\n", |
2045 | port = of_get_next_child(parent, port); | 2035 | __func__, prev->full_name)) |
2046 | if (!port) | 2036 | return NULL; |
2047 | return NULL; | ||
2048 | } while (of_node_cmp(port->name, "port")); | ||
2049 | 2037 | ||
2050 | /* Pick up the first endpoint in this port. */ | 2038 | /* Avoid dropping prev node refcount to 0. */ |
2051 | endpoint = of_get_next_child(port, NULL); | 2039 | of_node_get(prev); |
2040 | endpoint = of_get_next_child(port, prev); | ||
2041 | if (endpoint) { | ||
2052 | of_node_put(port); | 2042 | of_node_put(port); |
2043 | return endpoint; | ||
2053 | } | 2044 | } |
2054 | 2045 | ||
2046 | /* No more endpoints under this port, try the next one. */ | ||
2047 | do { | ||
2048 | port = of_get_next_child(parent, port); | ||
2049 | if (!port) | ||
2050 | return NULL; | ||
2051 | } while (of_node_cmp(port->name, "port")); | ||
2052 | |||
2053 | /* Pick up the first endpoint in this port. */ | ||
2054 | endpoint = of_get_next_child(port, NULL); | ||
2055 | of_node_put(port); | ||
2056 | |||
2055 | return endpoint; | 2057 | return endpoint; |
2056 | } | 2058 | } |
2057 | EXPORT_SYMBOL(of_graph_get_next_endpoint); | 2059 | EXPORT_SYMBOL(of_graph_get_next_endpoint); |