[dpdk-dev,1/9] pci: no need for dynamic tailq init
Commit Message
These lists can be initialized once and for all at build time.
With this, those lists are only manipulated in a common place
(and we could even make them private).
A nice side effect is that pci drivers can now register in constructors.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 3 ---
lib/librte_eal/common/eal_common_pci.c | 6 ++++--
lib/librte_eal/linuxapp/eal/eal_pci.c | 3 ---
3 files changed, 4 insertions(+), 8 deletions(-)
Comments
On Fri, 29 Jan 2016 15:08:28 +0100
David Marchand <david.marchand@6wind.com> wrote:
> These lists can be initialized once and for all at build time.
> With this, those lists are only manipulated in a common place
> (and we could even make them private).
>
> A nice side effect is that pci drivers can now register in constructors.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
@@ -483,9 +483,6 @@ int rte_eal_pci_write_config(const struct rte_pci_device *dev,
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
@@ -82,8 +82,10 @@
#include "eal_private.h"
-struct pci_driver_list pci_driver_list;
-struct pci_device_list pci_device_list;
+struct pci_driver_list pci_driver_list =
+ TAILQ_HEAD_INITIALIZER(pci_driver_list);
+struct pci_device_list pci_device_list =
+ TAILQ_HEAD_INITIALIZER(pci_device_list);
static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev)
{
@@ -625,9 +625,6 @@ int rte_eal_pci_write_config(const struct rte_pci_device *device,
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;