[PATCH] device connection: test only

From: Chunfeng Yun
Date: Thu May 23 2019 - 06:04:28 EST


Change-Id: Ie1b4b6304dfd7a89516fa3578aa5a5b1be924212
Signed-off-by: Chunfeng Yun <chunfeng.yun@xxxxxxxxxxxx>
---
drivers/base/devcon.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/drivers/base/devcon.c b/drivers/base/devcon.c
index 8311b70bbca2..1dae8b77562d 100644
--- a/drivers/base/devcon.c
+++ b/drivers/base/devcon.c
@@ -18,9 +18,11 @@ fwnode_graph_devcon_match(struct fwnode_handle *fwnode, const char *con_id,
{
struct device_connection con = { .id = con_id };
struct fwnode_handle *ep;
+ int ep_count = 0;
void *ret;

fwnode_graph_for_each_endpoint(fwnode, ep) {
+ ep_count++;
con.fwnode = fwnode_graph_get_remote_port_parent(ep);
if (!fwnode_device_is_available(con.fwnode))
continue;
@@ -32,6 +34,19 @@ fwnode_graph_devcon_match(struct fwnode_handle *fwnode, const char *con_id,
return ret;
}
}
+
+ /* if the connector has no remote endpoint, check its parent */
+ if (!ep_count) {
+ con.fwnode = fwnode_get_parent(fwnode);
+ if (!con.fwnode)
+ return NULL;
+
+ ret = match(&con, -1, data);
+ fwnode_handle_put(con.fwnode);
+ if (ret)
+ return ret;
+ }
+
return NULL;
}

--
2.21.0


--=-1DBptkwq7PrdOe2/R7LH--