summaryrefslogtreecommitdiff
path: root/lib/librte_eal/common/eal_common_bus.c
diff options
context:
space:
mode:
authorJan Blunck <jblunck@infradead.org>2017-06-30 20:19:37 +0200
committerThomas Monjalon <thomas@monjalon.net>2017-07-04 01:08:36 +0200
commit2f517390e5697d2bf8c68050a7dc3e2a5c0a5a31 (patch)
tree4338c068c3c9a42c4fd9c120d6d40a054430cda4 /lib/librte_eal/common/eal_common_bus.c
parent95d57b2b037ae505cf1a600adb08b731475a0b90 (diff)
downloaddpdk-2f517390e5697d2bf8c68050a7dc3e2a5c0a5a31.zip
dpdk-2f517390e5697d2bf8c68050a7dc3e2a5c0a5a31.tar.gz
dpdk-2f517390e5697d2bf8c68050a7dc3e2a5c0a5a31.tar.xz
bus: add helper to find bus by name
Signed-off-by: Jan Blunck <jblunck@infradead.org>
Diffstat (limited to 'lib/librte_eal/common/eal_common_bus.c')
-rw-r--r--lib/librte_eal/common/eal_common_bus.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
index b8a9e30..bf2b138 100644
--- a/lib/librte_eal/common/eal_common_bus.c
+++ b/lib/librte_eal/common/eal_common_bus.c
@@ -188,3 +188,17 @@ rte_bus_find_by_device(const struct rte_device *dev)
{
return rte_bus_find(NULL, bus_find_device, (const void *)dev);
}
+
+static int
+cmp_bus_name(const struct rte_bus *bus, const void *_name)
+{
+ const char *name = _name;
+
+ return strcmp(bus->name, name);
+}
+
+struct rte_bus *
+rte_bus_find_by_name(const char *busname)
+{
+ return rte_bus_find(NULL, cmp_bus_name, (const void *)busname);
+}