The close operation was never closing probed devices.
Taking a step back, reevaluating the devargs makes no sense during the
close step, as a probed device must have passed the allow/block list
evaluation earlier.

Since the device contains a reference to the driver that probed it,
simply call this driver remove op.

Fixes: 274fd921ff7f ("bus/fslmc: support close operation")
Cc: [email protected]

Signed-off-by: David Marchand <[email protected]>
---
 drivers/bus/fslmc/fslmc_vfio.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 550d4e0e8d..481bad196b 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -1393,7 +1393,7 @@ fslmc_close_iodevices(struct rte_dpaa2_device *dev,
 {
        struct rte_dpaa2_object *object = NULL;
        struct rte_dpaa2_driver *drv;
-       int ret, probe_all;
+       int ret;
 
        switch (dev->dev_type) {
        case DPAA2_IO:
@@ -1411,21 +1411,11 @@ fslmc_close_iodevices(struct rte_dpaa2_device *dev,
        case DPAA2_ETH:
        case DPAA2_CRYPTO:
        case DPAA2_QDMA:
-               probe_all = rte_fslmc_bus.bus.conf.scan_mode !=
-                           RTE_BUS_SCAN_ALLOWLIST;
-               TAILQ_FOREACH(drv, &rte_fslmc_bus.driver_list, next) {
-                       if (drv->drv_type != dev->dev_type)
-                               continue;
-                       if (rte_dev_is_probed(&dev->device))
-                               continue;
-                       if (probe_all ||
-                           (dev->device.devargs &&
-                            dev->device.devargs->policy ==
-                            RTE_DEV_ALLOWED)) {
-                               ret = drv->remove(dev);
-                               if (ret)
-                                       DPAA2_BUS_ERR("Unable to remove");
-                       }
+               drv = dev->driver;
+               if (drv && drv->remove) {
+                       ret = drv->remove(dev);
+                       if (ret)
+                               DPAA2_BUS_ERR("Unable to remove");
                }
                break;
        default:
-- 
2.53.0

Reply via email to