Subject: [PATCH v1 net-next 1/3] ptp_ocp: Switch to use module_pci_driver() macro

From: Andy Shevchenko <[email-masked]>
Date: Fri, 13 Aug 2021 15:27:35 +0300

Eliminate some boilerplate code by using module_pci_driver() instead of
init/exit, and, if needed, moving the salient bits from init into probe.

Signed-off-by: Andy Shevchenko <[email-masked]>
---
 drivers/ptp/ptp_ocp.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 0d1034e3ed0f..874ea7930079 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -4,7 +4,6 @@
 #include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/ptp_clock_kernel.h>
 
@@ -377,24 +376,7 @@ static struct pci_driver ptp_ocp_driver = {
 	.probe		= ptp_ocp_probe,
 	.remove		= ptp_ocp_remove,
 };
-
-static int __init
-ptp_ocp_init(void)
-{
-	int err;
-
-	err = pci_register_driver(&ptp_ocp_driver);
-	return err;
-}
-
-static void __exit
-ptp_ocp_fini(void)
-{
-	pci_unregister_driver(&ptp_ocp_driver);
-}
-
-module_init(ptp_ocp_init);
-module_exit(ptp_ocp_fini);
+module_pci_driver(ptp_ocp_driver);
 
 MODULE_DESCRIPTION("OpenCompute TimeCard driver");
 MODULE_LICENSE("GPL v2");
-- 
2.30.2