[dpdk-dev,v3,2/3] pci: Move driver registration above pci scan

Message ID 20170209165959.28082-2-benjamin.walker@intel.com (mailing list archive)
State Rejected, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel compilation success Compilation OK

Commit Message

Walker, Benjamin Feb. 9, 2017, 4:59 p.m. UTC
  The user needs to register drivers before scanning, so
it makes the most sense to put the registration
functions above the scan function in the header file.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
---

Only rebased onto latest master with the rest of this series.
No changes.

 lib/librte_eal/common/include/rte_pci.h | 56 ++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 28 deletions(-)
  

Patch

diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 8557e47..5640896 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -362,6 +362,34 @@  rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
 }
 
 /**
+ * Register a PCI driver.
+ *
+ * @param driver
+ *   A pointer to a rte_pci_driver structure describing the driver
+ *   to be registered.
+ */
+void rte_eal_pci_register(struct rte_pci_driver *driver);
+
+/** Statically register a PCI driver at start up */
+#define RTE_PMD_REGISTER_PCI(nm, pci_drv) \
+RTE_INIT(pciinitfn_ ##nm); \
+static void pciinitfn_ ##nm(void) \
+{\
+	(pci_drv).driver.name = RTE_STR(nm);\
+	rte_eal_pci_register(&pci_drv); \
+} \
+RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+
+/**
+ * Unregister a PCI driver.
+ *
+ * @param driver
+ *   A pointer to a rte_pci_driver structure describing the driver
+ *   to be unregistered.
+ */
+void rte_eal_pci_unregister(struct rte_pci_driver *driver);
+
+/**
  * Scan the content of the PCI bus, and the devices in the devices
  * list
  *
@@ -480,34 +508,6 @@  int rte_eal_pci_detach(const struct rte_pci_addr *addr);
 void rte_eal_pci_dump(FILE *f);
 
 /**
- * Register a PCI driver.
- *
- * @param driver
- *   A pointer to a rte_pci_driver structure describing the driver
- *   to be registered.
- */
-void rte_eal_pci_register(struct rte_pci_driver *driver);
-
-/** Helper for PCI device registration from driver (eth, crypto) instance */
-#define RTE_PMD_REGISTER_PCI(nm, pci_drv) \
-RTE_INIT(pciinitfn_ ##nm); \
-static void pciinitfn_ ##nm(void) \
-{\
-	(pci_drv).driver.name = RTE_STR(nm);\
-	rte_eal_pci_register(&pci_drv); \
-} \
-RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
-
-/**
- * Unregister a PCI driver.
- *
- * @param driver
- *   A pointer to a rte_pci_driver structure describing the driver
- *   to be unregistered.
- */
-void rte_eal_pci_unregister(struct rte_pci_driver *driver);
-
-/**
  * Read PCI config space.
  *
  * @param device