From 48af1214f951eb8caeb6bf6d5b65720f4d3c1368 Mon Sep 17 00:00:00 2001 From: Jan Blunck Date: Tue, 11 Jul 2017 19:15:47 -0400 Subject: [PATCH] bus/vdev: use local bus reference It isn't necessary to use rte_bus_find_by_name() to find a reference to our own bus. Signed-off-by: Jan Blunck Acked-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_vdev.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c index 2ca0cdb0fc..5abdba0910 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -47,6 +47,9 @@ #include #include +/* Forward declare to access virtual bus name */ +static struct rte_bus rte_vdev_bus; + /** Double linked list of virtual device drivers. */ TAILQ_HEAD(vdev_device_list, rte_vdev_device); @@ -138,7 +141,7 @@ alloc_devargs(const char *name, const char *args) if (!devargs) return NULL; - devargs->bus = rte_bus_find_by_name("vdev"); + devargs->bus = &rte_vdev_bus; if (args) devargs->args = strdup(args); @@ -250,13 +253,11 @@ vdev_scan(void) { struct rte_vdev_device *dev; struct rte_devargs *devargs; - struct rte_bus *vbus; /* for virtual devices we scan the devargs_list populated via cmdline */ - vbus = rte_bus_find_by_name("vdev"); TAILQ_FOREACH(devargs, &devargs_list, next) { - if (devargs->bus != vbus) + if (devargs->bus != &rte_vdev_bus) continue; dev = find_vdev(devargs->name); -- 2.20.1