tailq: move to dynamic tailq
[dpdk.git] / lib / librte_eal / linuxapp / eal / eal_pci.c
index f880f90..c42e843 100644 (file)
@@ -37,7 +37,6 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
-#include <rte_tailq.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 
 struct mapped_pci_res_list *pci_res_list = NULL;
 
+static struct rte_tailq_elem rte_pci_tailq = {
+       .name = "PCI_RESOURCE_LIST",
+};
+EAL_REGISTER_TAILQ(rte_pci_tailq)
+
 /* unbind kernel driver for this device */
 static int
 pci_unbind_kernel_driver(struct rte_pci_device *dev)
@@ -440,8 +444,8 @@ error:
  * Scan the content of the PCI bus, and the devices in the devices
  * list
  */
-static int
-pci_scan(void)
+int
+rte_eal_pci_scan(void)
 {
        struct dirent *e;
        DIR *dir;
@@ -766,14 +770,13 @@ rte_eal_pci_init(void)
 {
        TAILQ_INIT(&pci_driver_list);
        TAILQ_INIT(&pci_device_list);
-       pci_res_list = RTE_TAILQ_RESERVE_BY_IDX(RTE_TAILQ_PCI,
-                       mapped_pci_res_list);
+       pci_res_list = RTE_TAILQ_CAST(rte_pci_tailq.head, mapped_pci_res_list);
 
        /* for debug purposes, PCI can be disabled */
        if (internal_config.no_pci)
                return 0;
 
-       if (pci_scan() < 0) {
+       if (rte_eal_pci_scan() < 0) {
                RTE_LOG(ERR, EAL, "%s(): Cannot scan PCI bus\n", __func__);
                return -1;
        }