aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/devcon.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/devcon.c')
-rw-r--r--drivers/base/devcon.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/base/devcon.c b/drivers/base/devcon.c
index 04db9ae235e4..f7035fc12b92 100644
--- a/drivers/base/devcon.c
+++ b/drivers/base/devcon.c
@@ -38,6 +38,28 @@ fwnode_graph_devcon_match(struct fwnode_handle *fwnode, const char *con_id,
38 return NULL; 38 return NULL;
39} 39}
40 40
41static void *
42fwnode_devcon_match(struct fwnode_handle *fwnode, const char *con_id,
43 void *data, devcon_match_fn_t match)
44{
45 struct device_connection con = { };
46 void *ret;
47 int i;
48
49 for (i = 0; ; i++) {
50 con.fwnode = fwnode_find_reference(fwnode, con_id, i);
51 if (IS_ERR(con.fwnode))
52 break;
53
54 ret = match(&con, -1, data);
55 fwnode_handle_put(con.fwnode);
56 if (ret)
57 return ret;
58 }
59
60 return NULL;
61}
62
41/** 63/**
42 * device_connection_find_match - Find physical connection to a device 64 * device_connection_find_match - Find physical connection to a device
43 * @dev: Device with the connection 65 * @dev: Device with the connection
@@ -65,6 +87,10 @@ void *device_connection_find_match(struct device *dev, const char *con_id,
65 ret = fwnode_graph_devcon_match(fwnode, con_id, data, match); 87 ret = fwnode_graph_devcon_match(fwnode, con_id, data, match);
66 if (ret) 88 if (ret)
67 return ret; 89 return ret;
90
91 ret = fwnode_devcon_match(fwnode, con_id, data, match);
92 if (ret)
93 return ret;
68 } 94 }
69 95
70 mutex_lock(&devcon_lock); 96 mutex_lock(&devcon_lock);