[PATCH v4 2/7] bus/fslmc: fix bus cleanup

David Marchand
2026-04-14T12:39:26Z

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 initially.

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: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Maxime Leroy <maxime@leroys.fr>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/bus/fslmc/fslmc_vfio.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 550d4e0e8d..7daa18d850 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,22 +1411,9 @@ 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 && drv->remove(dev))
+ DPAA2_BUS_ERR("Unable to remove");
break;
default:
break;
--
2.53.0