[PATCH 07/13] staging: comedi: adv_pci1724: use module_comedi_pci_driver()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use the `module_comedi_pci_driver()` macro to register the driver as a
comedi PCI driver instead of hand-coding the module init and exit
routines.  That also requires that we set the `name` member of the
`struct pci_driver` with an initializer, so do so.

Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Frank Mori Hess <fmh6jj@xxxxxxxxx>
---
 drivers/staging/comedi/drivers/adv_pci1724.c | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adv_pci1724.c b/drivers/staging/comedi/drivers/adv_pci1724.c
index c500e4f..36cc876 100644
--- a/drivers/staging/comedi/drivers/adv_pci1724.c
+++ b/drivers/staging/comedi/drivers/adv_pci1724.c
@@ -186,32 +186,13 @@ static int adv_pci1724_pci_probe(struct pci_dev *dev,
 }
 
 static struct pci_driver adv_pci1724_pci_driver = {
+	.name = "adv_pci1724",
 	.id_table = adv_pci1724_pci_table,
 	.probe = adv_pci1724_pci_probe,
 	.remove = comedi_pci_auto_unconfig,
 };
 
-static int __init adv_pci1724_init_module(void)
-{
-	int retval;
-
-	retval = comedi_driver_register(&adv_pci1724_driver);
-	if (retval < 0)
-		return retval;
-
-	adv_pci1724_pci_driver.name =
-		(char *)adv_pci1724_driver.driver_name;
-	return pci_register_driver(&adv_pci1724_pci_driver);
-}
-
-static void __exit adv_pci1724_cleanup_module(void)
-{
-	pci_unregister_driver(&adv_pci1724_pci_driver);
-	comedi_driver_unregister(&adv_pci1724_driver);
-}
-
-module_init(adv_pci1724_init_module);
-module_exit(adv_pci1724_cleanup_module);
+module_comedi_pci_driver(adv_pci1724_driver, adv_pci1724_pci_driver);
 
 /* Allocate and initialize the subdevice structures.
  */
-- 
1.8.1.2

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux