From bd291df4d0247fce5c11da746ae0761420054cf7 Mon Sep 17 00:00:00 2001 From: Chunfeng Yun Date: Thu, 23 May 2019 18:04:28 +0800 Subject: [PATCH] device connection: test only Change-Id: Ie1b4b6304dfd7a89516fa3578aa5a5b1be924212 Signed-off-by: Chunfeng Yun --- 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