Commit 26cf91f4 authored by Lukas Wunner's avatar Lukas Wunner Committed by Greg Kroah-Hartman

coresight: Deduplicate bus_find_device() by name matching

No need to reinvent the wheel, we have bus_find_device_by_name().
Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bbecb07f
...@@ -843,32 +843,17 @@ static void coresight_fixup_orphan_conns(struct coresight_device *csdev) ...@@ -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) static void coresight_fixup_device_conns(struct coresight_device *csdev)
{ {
int i; int i;
struct device *dev = NULL;
struct coresight_connection *conn;
for (i = 0; i < csdev->nr_outport; i++) { for (i = 0; i < csdev->nr_outport; i++) {
conn = &csdev->conns[i]; struct coresight_connection *conn = &csdev->conns[i];
dev = bus_find_device(&coresight_bustype, NULL, struct device *dev = NULL;
(void *)conn->child_name,
coresight_name_match);
if (conn->child_name)
dev = bus_find_device_by_name(&coresight_bustype, NULL,
conn->child_name);
if (dev) { if (dev) {
conn->child_dev = to_coresight_device(dev); conn->child_dev = to_coresight_device(dev);
/* and put reference from 'bus_find_device()' */ /* and put reference from 'bus_find_device()' */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment