vfio/mlx5: Switch to use module_pci_driver() macro
authorShang XiaoJing <shangxiaojing@huawei.com>
Thu, 22 Sep 2022 12:35:07 +0000 (20:35 +0800)
committerAlex Williamson <alex.williamson@redhat.com>
Wed, 9 Nov 2022 23:38:31 +0000 (16:38 -0700)
Since pci provides the helper macro module_pci_driver(), we may replace
the module_init/exit with it.

Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Reviewed-by: Yishai Hadas <yishaih@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20220922123507.11222-1-shangxiaojing@huawei.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/mlx5/main.c

index fd6ccb8454a24a496c351fb415f96ee2fd9361a5..457138b92f1347f7310c2d2c0eae6028c19b262c 100644 (file)
@@ -676,18 +676,7 @@ static struct pci_driver mlx5vf_pci_driver = {
        .driver_managed_dma = true,
 };
 
-static void __exit mlx5vf_pci_cleanup(void)
-{
-       pci_unregister_driver(&mlx5vf_pci_driver);
-}
-
-static int __init mlx5vf_pci_init(void)
-{
-       return pci_register_driver(&mlx5vf_pci_driver);
-}
-
-module_init(mlx5vf_pci_init);
-module_exit(mlx5vf_pci_cleanup);
+module_pci_driver(mlx5vf_pci_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Max Gurtovoy <mgurtovoy@nvidia.com>");