aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Wunner <lukas@wunner.de>2017-11-25 11:51:19 +0100
committerMathieu Poirier <mathieu.poirier@linaro.org>2017-11-27 13:33:44 -0700
commit26fabc4585ae48d9d26abe3db94e2878c331df66 (patch)
treeae50db2fb0f138e17b1a7037690c9ea54627dd51
parent4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323 (diff)
downloadcoresight-26fabc4585ae48d9d26abe3db94e2878c331df66.tar.gz
coresight: Deduplicate bus_find_device() by name matching
No need to reinvent the wheel, we have bus_find_device_by_name(). Signed-off-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
-rw-r--r--drivers/hwtracing/coresight/coresight.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
index b8091be..389c4ba 100644
--- a/drivers/hwtracing/coresight/coresight.c
+++ b/drivers/hwtracing/coresight/coresight.c
@@ -843,32 +843,17 @@ static void coresight_fixup_orphan_conns(struct coresight_device *csdev)
}
-static int coresight_name_match(struct device *dev, void *data)
-{
- char *to_match;
- struct coresight_device *i_csdev;
-
- to_match = data;
- i_csdev = to_coresight_device(dev);
-
- if (to_match && !strcmp(to_match, dev_name(&i_csdev->dev)))
- return 1;
-
- return 0;
-}
-
static void coresight_fixup_device_conns(struct coresight_device *csdev)
{
int i;
- struct device *dev = NULL;
- struct coresight_connection *conn;
for (i = 0; i < csdev->nr_outport; i++) {
- conn = &csdev->conns[i];
- dev = bus_find_device(&coresight_bustype, NULL,
- (void *)conn->child_name,
- coresight_name_match);
+ struct coresight_connection *conn = &csdev->conns[i];
+ struct device *dev = NULL;
+ if (conn->child_name)
+ dev = bus_find_device_by_name(&coresight_bustype, NULL,
+ conn->child_name);
if (dev) {
conn->child_dev = to_coresight_device(dev);
/* and put reference from 'bus_find_device()' */