diff mbox series

[1/2,resend] OF: add of_graph_get_port()

Message ID 87pnuq0whu.wl-kuninori.morimoto.gx@renesas.com
State Rejected, archived
Headers show
Series OF: add functions for port | expand

Checks

Context Check Description
robh/checkpatch success

Commit Message

Kuninori Morimoto Nov. 28, 2018, 2:34 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

We have of_graph_get_port_parent(), of_graph_get_port_by_id(),
but don't have of_graph_get_port().
Thus we are using of_get_parent() to getting port from endpoint,
but it is not understandable. Let's add of_graph_get_port().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/of/property.c    | 8 ++++----
 include/linux/of_graph.h | 2 ++
 2 files changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/of/property.c b/drivers/of/property.c
index f46828e..3db01ee 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -531,7 +531,7 @@  EXPORT_SYMBOL_GPL(of_prop_next_string);
 int of_graph_parse_endpoint(const struct device_node *node,
 			    struct of_endpoint *endpoint)
 {
-	struct device_node *port_node = of_get_parent(node);
+	struct device_node *port_node = of_graph_get_port(node);
 
 	WARN_ONCE(!port_node, "%s(): endpoint %pOF has no parent node\n",
 		  __func__, node);
@@ -621,7 +621,7 @@  struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
 			return NULL;
 		}
 	} else {
-		port = of_get_parent(prev);
+		port = of_graph_get_port(prev);
 		if (WARN_ONCE(!port, "%s(): endpoint %pOF has no parent node\n",
 			      __func__, prev))
 			return NULL;
@@ -874,7 +874,7 @@  of_fwnode_property_read_string_array(const struct fwnode_handle *fwnode,
 static struct fwnode_handle *
 of_fwnode_get_parent(const struct fwnode_handle *fwnode)
 {
-	return of_fwnode_handle(of_get_parent(to_of_node(fwnode)));
+	return of_fwnode_handle(of_graph_get_port(to_of_node(fwnode)));
 }
 
 static struct fwnode_handle *
@@ -965,7 +965,7 @@  static int of_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
 					  struct fwnode_endpoint *endpoint)
 {
 	const struct device_node *node = to_of_node(fwnode);
-	struct device_node *port_node = of_get_parent(node);
+	struct device_node *port_node = of_graph_get_port(node);
 
 	endpoint->local_fwnode = fwnode;
 
diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h
index 01038a6..7fbbf80 100644
--- a/include/linux/of_graph.h
+++ b/include/linux/of_graph.h
@@ -37,6 +37,8 @@  struct of_endpoint {
 	for (child = of_graph_get_next_endpoint(parent, NULL); child != NULL; \
 	     child = of_graph_get_next_endpoint(parent, child))
 
+#define of_graph_get_port(endpoint) of_get_parent(endpoint)
+
 #ifdef CONFIG_OF
 int of_graph_parse_endpoint(const struct device_node *node,
 				struct of_endpoint *endpoint);