bus/vmbus: add cleanup support
PATCH 1/1 bus/vmbus: add cleanup support
From: Long Li <[email protected]>
Implement VMBUS cleanup callback from eal_cleanup().
Signed-off-by Long Li <[email protected]>
--- drivers/bus/vmbus/vmbus_common.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/bus/vmbus/vmbus_common.c +29 -0
@@ -188,6 +188,34 @@ rte_vmbus_probe(void)return (probed && probed == failed) ?-1 :0 ; } +static int +rte_vmbus_cleanup (void ) +{ +struct rte_vmbus_device *dev, *tmp_dev; +int error =0 ; + + RTE_TAILQ_FOREACH_SAFE(dev, &rte_vmbus_bus.device_list, next, tmp_dev) { + +const struct rte_vmbus_driver *drv = dev->driver; +int ret; + +if (!drv || !drv->remove) +continue ; + + ret = drv->remove (dev); +if (ret <0 ) + error =-1 ; + +rte_vmbus_unmap_device (dev); + + dev->driver =NULL ; + dev->device.driver =NULL ; +free (dev); + } + +return error; +} +static int vmbus_parse (const char *name,void *addr) {
@@ -285,6 +313,7 @@ struct rte_vmbus_bus rte_vmbus_bus = { .bus = { .scan = rte_vmbus_scan, .probe = rte_vmbus_probe, + .cleanup = rte_vmbus_cleanup, .find_device = vmbus_find_device, .parse = vmbus_parse, },
Signature · 1 line
2.32.0
Thomas Monjalon
Applied21/03/2023 20:31, [email protected]:
Quoted 19 lines
From: Long Li <[email protected]>
Implement VMBUS cleanup callback from
eal_cleanup().Signed-off-by Long Li <[email protected]>--- drivers/bus/vmbus/vmbus_common.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)drivers/bus/vmbus/vmbus_common.c +2
-0@@ -188,6 +188,34 @@ rte_vmbus_probe(void)return (probed && probed == failed) ?-1 :0 ; } +static int +rte_vmbus_cleanup (void )
drivers/bus/vmbus/vmbus_common.c rte_vmbus_probe(void) · line 202
Quoted 10 lines
drivers/bus/vmbus/vmbus_common.c +10
-0+{ +struct rte_vmbus_device *dev, *tmp_dev; +int error =0 ; + + RTE_TAILQ_FOREACH_SAFE(dev, &rte_vmbus_bus.device_list, next, tmp_dev) { + +const struct rte_vmbus_driver *drv = dev->driver; +int ret; + +if (!drv || !drv->remove)
Changed to "== NULL" comparisons for the style :)
Quoted 5 lines
drivers/bus/vmbus/vmbus_common.c +5
-0+continue ; + + ret = drv->remove (dev); +if (ret <0 ) + error =-1 ;
drivers/bus/vmbus/vmbus_common.c rte_vmbus_probe(void) · line 217
Quoted 10 lines
drivers/bus/vmbus/vmbus_common.c +10
-0+ +rte_vmbus_unmap_device (dev); + + dev->driver =NULL ; + dev->device.driver =NULL ; +free (dev); + } + +return error; +}
Applied, thanks.