Re: [PATCH v8 1/6] vfio: Mediated device Core driver

Tian, Kevin
2016-10-12T08:39:08Z

> From: Kirti Wankhede
> Sent: Tuesday, October 11, 2016 4:29 AM
>
[...]

> +
> +/*
> + * mdev_unregister_device : Unregister a parent device
> + * @dev: device structure representing parent device.
> + *
> + * Remove device from list of registered parent devices. Give a chance to free
> + * existing mediated devices for given device.
> + */
> +
> +void mdev_unregister_device(struct device *dev)
> +{
> + struct parent_device *parent;
> + bool force_remove = true;
> +
> + mutex_lock(&parent_list_lock);
> + parent = __find_parent_device(dev);
> +
> + if (!parent) {
> + mutex_unlock(&parent_list_lock);
> + return;
> + }
> + dev_info(dev, "MDEV: Unregistering\n");
> +
> + /*
> + * Remove parent from the list and remove "mdev_supported_types"
> + * sysfs files so that no new mediated device could be
> + * created for this parent
> + */
> + list_del(&parent->next);
> + parent_remove_sysfs_files(parent);

this could be moved out of mutex.

> +
> + mutex_unlock(&parent_list_lock);
> +
> + device_for_each_child(dev, (void *)&force_remove, mdev_device_remove);
> + mdev_put_parent(parent);
> +}
> +EXPORT_SYMBOL(mdev_unregister_device);
> +

Thanks
Kevin