[PATCH v2 16/33] staging: comedi: dt9812: use module_comedi_usb_driver()

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

 



Now that the semaphore used by the comedi_driver is initialized
when the comedi_device private data is allocated, the module_init()
in this driver just clears the 'slot' data before calling
comedi_usb_driver_register(). This static data will already be
cleared when the driver is loaded.

Replace the module_{init,exit}() with the module_comedi_usb_driver()
macro to remove the boilerplate code.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/dt9812.c | 23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt9812.c b/drivers/staging/comedi/drivers/dt9812.c
index 7c26866..8a4462a 100644
--- a/drivers/staging/comedi/drivers/dt9812.c
+++ b/drivers/staging/comedi/drivers/dt9812.c
@@ -1022,28 +1022,7 @@ static struct usb_driver dt9812_usb_driver = {
 	.probe		= dt9812_probe,
 	.disconnect	= dt9812_disconnect,
 };
-
-static int __init usb_dt9812_init(void)
-{
-	int i;
-
-	/* Initialize all driver slots */
-	for (i = 0; i < DT9812_NUM_SLOTS; i++) {
-		dt9812[i].usb = NULL;
-		dt9812[i].devpriv = NULL;
-	}
-
-	return comedi_usb_driver_register(&dt9812_comedi_driver,
-						&dt9812_usb_driver);
-}
-
-static void __exit usb_dt9812_exit(void)
-{
-	comedi_usb_driver_unregister(&dt9812_comedi_driver, &dt9812_usb_driver);
-}
-
-module_init(usb_dt9812_init);
-module_exit(usb_dt9812_exit);
+module_comedi_usb_driver(dt9812_comedi_driver, dt9812_usb_driver);
 
 MODULE_AUTHOR("Anders Blomdell <anders.blomdell@xxxxxxxxxxxxxx>");
 MODULE_DESCRIPTION("Comedi DT9812 driver");
-- 
1.8.1.4

_______________________________________________
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