bus/vdev: use standard bus registration
authorGaetan Rivet <gaetan.rivet@6wind.com>
Tue, 27 Jun 2017 16:11:15 +0000 (18:11 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 3 Jul 2017 23:07:53 +0000 (01:07 +0200)
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
lib/librte_eal/common/eal_common_vdev.c
lib/librte_eal/common/include/rte_vdev.h

index 0037a64..b4db2be 100644 (file)
@@ -52,14 +52,10 @@ static struct vdev_device_list vdev_device_list =
 struct vdev_driver_list vdev_driver_list =
        TAILQ_HEAD_INITIALIZER(vdev_driver_list);
 
-static void rte_vdev_bus_register(void);
-
 /* register a driver */
 void
 rte_vdev_register(struct rte_vdev_driver *driver)
 {
-       rte_vdev_bus_register();
-
        TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
 }
 
@@ -343,16 +339,4 @@ static struct rte_bus rte_vdev_bus = {
        .probe = vdev_probe,
 };
 
-RTE_INIT(rte_vdev_bus_register);
-
-static void rte_vdev_bus_register(void)
-{
-       static int registered;
-
-       if (registered)
-               return;
-
-       registered = 1;
-       rte_vdev_bus.name = RTE_STR(virtual);
-       rte_bus_register(&rte_vdev_bus);
-}
+RTE_REGISTER_BUS(VIRTUAL_BUS_NAME, rte_vdev_bus);
index e6b678e..2d02c68 100644 (file)
@@ -41,6 +41,8 @@ extern "C" {
 #include <rte_dev.h>
 #include <rte_devargs.h>
 
+#define VIRTUAL_BUS_NAME "virtual"
+
 struct rte_vdev_device {
        TAILQ_ENTRY(rte_vdev_device) next;      /**< Next attached vdev */
        struct rte_device device;               /**< Inherit core device */