[Intel-gfx] [PATCH 08/12] vfio/gvt: Convert to use vfio_register_group_dev()
Christoph Hellwig
hch at lst.de
Mon Apr 26 14:13:55 UTC 2021
> diff --git a/drivers/vfio/mdev/Makefile b/drivers/vfio/mdev/Makefile
> index ff9ecd80212503..7c236ba1b90eb1 100644
> --- a/drivers/vfio/mdev/Makefile
> +++ b/drivers/vfio/mdev/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0-only
>
> -mdev-y := mdev_core.o mdev_sysfs.o mdev_driver.o vfio_mdev.o
> +mdev-y := mdev_core.o mdev_sysfs.o mdev_driver.o
>
> obj-$(CONFIG_VFIO_MDEV) += mdev.o
> diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c
> index 51b8a9fcf866ad..f95d01b57fb168 100644
> --- a/drivers/vfio/mdev/mdev_core.c
> +++ b/drivers/vfio/mdev/mdev_core.c
I think all these mdev core changes belong into a separate commit with a
separate commit log.
> static int __init mdev_init(void)
> {
> - int rc;
> -
> - rc = mdev_bus_register();
> - if (rc)
> - return rc;
> - rc = mdev_register_driver(&vfio_mdev_driver);
> - if (rc)
> - goto err_bus;
> - return 0;
> -err_bus:
> - mdev_bus_unregister();
> - return rc;
> + return mdev_bus_register();
Weird indentation. But I think it would be best to just kill off the
mdev_init wrapper anyway.
> static void __exit mdev_exit(void)
> {
> - mdev_unregister_driver(&vfio_mdev_driver);
> -
> if (mdev_bus_compat_class)
> class_compat_unregister(mdev_bus_compat_class);
> -
> mdev_bus_unregister();
> }
Same here.
> diff --git a/drivers/vfio/mdev/mdev_driver.c b/drivers/vfio/mdev/mdev_driver.c
> index 6e96c023d7823d..0012a9ee7cb0a4 100644
> --- a/drivers/vfio/mdev/mdev_driver.c
> +++ b/drivers/vfio/mdev/mdev_driver.c
> @@ -74,15 +74,8 @@ static int mdev_remove(struct device *dev)
> static int mdev_match(struct device *dev, struct device_driver *drv)
> {
> struct mdev_device *mdev = to_mdev_device(dev);
> +
> + return drv == &mdev->type->parent->ops->device_driver->driver;
> }
Btw, I think we don't even need ->match with the switch to use
device_bind_driver that I suggested.
> -EXPORT_SYMBOL_GPL(vfio_init_group_dev);
> +EXPORT_SYMBOL(vfio_init_group_dev);
> -EXPORT_SYMBOL_GPL(vfio_register_group_dev);
> +EXPORT_SYMBOL(vfio_register_group_dev);
> -EXPORT_SYMBOL_GPL(vfio_unregister_group_dev);
> +EXPORT_SYMBOL(vfio_unregister_group_dev);
Err, no. vfio should remain EXPORT_SYMBOL_GPL, just because the weird
mdev "GPL condom" that should never have been merged in that form went away.
More information about the Intel-gfx
mailing list