Thread (10 messages) flat view 10 messages, 5 authors, 2021-08-17
STALE1828d

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

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: 2021-08-13 12:27:50
Also in: lkml
Subsystem: networking drivers, opencompute ptp clock driver, ptp hardware clock support, the rest · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Vadim Fedorenko, Richard Cochran, Linus Torvalds

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 <andriy.shevchenko@linux.intel.com>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help