[PATCH] bus/vmbus: add cleanup support

Thomas Monjalon thomas at monjalon.net
Tue Jun 6 16:27:01 CEST 2023


21/03/2023 20:31, longli at linuxonhyperv.com:
> From: Long Li <longli at microsoft.com>
> 
> Implement VMBUS cleanup callback from eal_cleanup().
> 
> Signed-off-by: Long Li <longli at microsoft.com>
> ---
>  drivers/bus/vmbus/vmbus_common.c | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
> index 8d32d66504..a6277bfc06 100644
> --- a/drivers/bus/vmbus/vmbus_common.c
> +++ b/drivers/bus/vmbus/vmbus_common.c
> @@ -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)

Changed to "== NULL" comparisons for the style :)

> +			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;
> +}

Applied, thanks.




More information about the dev mailing list