summaryrefslogtreecommitdiff
path: root/drivers/bus/ifpga
diff options
context:
space:
mode:
authorThomas Monjalon <thomas@monjalon.net>2018-09-25 22:55:27 +0200
committerThomas Monjalon <thomas@monjalon.net>2018-10-17 10:26:59 +0200
commit391797f04208aec3a75efd01bfa368899b2f37db (patch)
tree63105172165dc6e010341bacf920329da21b444b /drivers/bus/ifpga
parent9fca82045935147838d59154c3dada582b7c7fe4 (diff)
downloaddpdk-391797f04208aec3a75efd01bfa368899b2f37db.zip
dpdk-391797f04208aec3a75efd01bfa368899b2f37db.tar.gz
dpdk-391797f04208aec3a75efd01bfa368899b2f37db.tar.xz
drivers/bus: move driver assignment to end of probing
The PCI mapping requires to know the PCI driver to use, even before the probing is done. That's why the PCI driver is referenced early inside the PCI device structure. See commit 1d20a073fa5e ("bus/pci: reference driver structure before mapping") However the rte_driver does not need to be referenced in rte_device before the device probing is done. By moving back this assignment at the end of the device probing, it becomes possible to make clear the status of a rte_device. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com> Tested-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Rosen Xu <rosen.xu@intel.com>
Diffstat (limited to 'drivers/bus/ifpga')
-rw-r--r--drivers/bus/ifpga/ifpga_bus.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index 8066332..fca2dba 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -280,14 +280,13 @@ ifpga_probe_one_driver(struct rte_afu_driver *drv,
/* reference driver structure */
afu_dev->driver = drv;
- afu_dev->device.driver = &drv->driver;
/* call the driver probe() function */
ret = drv->probe(afu_dev);
- if (ret) {
+ if (ret)
afu_dev->driver = NULL;
- afu_dev->device.driver = NULL;
- }
+ else
+ afu_dev->device.driver = &drv->driver;
return ret;
}
@@ -302,7 +301,7 @@ ifpga_probe_all_drivers(struct rte_afu_device *afu_dev)
return -1;
/* Check if a driver is already loaded */
- if (afu_dev->driver != NULL)
+ if (afu_dev->device.driver != NULL)
return 0;
TAILQ_FOREACH(drv, &ifpga_afu_drv_list, next) {