Thread (54 messages) 54 messages, 5 authors, 2018-07-02
STALE2923d REVIEWED: 1 (0M)
Revisions (3)
  1. v1 [diff vs current]
  2. v2 current
  3. v3 [diff vs current]

[PATCH v2 2/4] bus/pci: reference driver structure

From: Rafal Kozik <hidden>
Date: 2018-06-28 13:16:13
Subsystem: the rest · Maintainer: Linus Torvalds

Add pointer to driver structure before calling rte_pci_map_device.
It allows to use driver flags for adjusting configuration.

Signed-off-by: Rafal Kozik <redacted>
Acked-by: Bruce Richardson <redacted>

---
 drivers/bus/pci/pci_common.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index d8151b0..8f5d77f 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -158,17 +158,24 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
 	RTE_LOG(INFO, EAL, "  probe driver: %x:%x %s\n", dev->id.vendor_id,
 		dev->id.device_id, dr->driver.name);
 
+	/*
+	 * reference driver structure
+	 * This need to be before rte_pci_map_device(), as it enable to use
+	 * driver flags for adjusting configuration.
+	 */
+	dev->driver = dr;
+	dev->device.driver = &dr->driver;
+
 	if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
 		/* map resources for devices that use igb_uio */
 		ret = rte_pci_map_device(dev);
-		if (ret != 0)
+		if (ret != 0) {
+			dev->driver = NULL;
+			dev->device.driver = NULL;
 			return ret;
+		}
 	}
 
-	/* reference driver structure */
-	dev->driver = dr;
-	dev->device.driver = &dr->driver;
-
 	/* call the driver probe() function */
 	ret = dr->probe(dr, dev);
 	if (ret) {
-- 
2.7.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help