diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2012-07-03 01:10:46 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-06 22:51:20 (GMT) |
commit | 17f49dd46c5db2912d2dd985f400f6237fd30255 (patch) | |
tree | 1fa5b3e9436e0cddc28e19ab4622b6083ae5e406 | |
parent | 6f88a20a7ff0b8724b9832c139fc06095e71b9bf (diff) | |
download | linux-fsl-qoriq-17f49dd46c5db2912d2dd985f400f6237fd30255.tar.xz |
staging: comedi: dmm32at: use module_comedi_driver
Convert driver to use the module_comedi_driver() macro to remove
some of the boilerplate.
Move the comedi_driver variable to the end of the file to keep it
with the module_comedi_driver() macro. This also removes the need
for some of the forward declarations. While moving the variable:
1) strip out the unnecessary cut-and-paste skel driver comments
2) add whitespace to improve the readability
3) rename the variable from driver* to *driver
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/dmm32at.c | 63 |
1 files changed, 10 insertions, 53 deletions
diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index af353167..ad7fef9 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -211,43 +211,6 @@ struct dmm32at_private { */ #define devpriv ((struct dmm32at_private *)dev->private) -/* - * The struct comedi_driver structure tells the Comedi core module - * which functions to call to configure/deconfigure (attach/detach) - * the board, and also about the kernel module that contains - * the device code. - */ -static int dmm32at_attach(struct comedi_device *dev, - struct comedi_devconfig *it); -static void dmm32at_detach(struct comedi_device *dev); -static struct comedi_driver driver_dmm32at = { - .driver_name = "dmm32at", - .module = THIS_MODULE, - .attach = dmm32at_attach, - .detach = dmm32at_detach, -/* It is not necessary to implement the following members if you are - * writing a driver for a ISA PnP or PCI card */ -/* Most drivers will support multiple types of boards by - * having an array of board structures. These were defined - * in dmm32at_boards[] above. Note that the element 'name' - * was first in the structure -- Comedi uses this fact to - * extract the name of the board without knowing any details - * about the structure except for its length. - * When a device is attached (by comedi_config), the name - * of the device is given to Comedi, and Comedi tries to - * match it by going through the list of board names. If - * there is a match, the address of the pointer is put - * into dev->board_ptr and driver->attach() is called. - * - * Note that these are not necessary if you can determine - * the type of board in software. ISA PnP, PCI, and PCMCIA - * devices are such boards. - */ - .board_name = &dmm32at_boards[0].name, - .offset = sizeof(struct dmm32at_board), - .num_names = ARRAY_SIZE(dmm32at_boards), -}; - /* prototypes for driver functions below */ static int dmm32at_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, @@ -1027,22 +990,16 @@ void dmm32at_setaitimer(struct comedi_device *dev, unsigned int nansec) } -/* - * A convenient macro that defines init_module() and cleanup_module(), - * as necessary. - */ -static int __init driver_dmm32at_init_module(void) -{ - return comedi_driver_register(&driver_dmm32at); -} - -static void __exit driver_dmm32at_cleanup_module(void) -{ - comedi_driver_unregister(&driver_dmm32at); -} - -module_init(driver_dmm32at_init_module); -module_exit(driver_dmm32at_cleanup_module); +static struct comedi_driver dmm32at_driver = { + .driver_name = "dmm32at", + .module = THIS_MODULE, + .attach = dmm32at_attach, + .detach = dmm32at_detach, + .board_name = &dmm32at_boards[0].name, + .offset = sizeof(struct dmm32at_board), + .num_names = ARRAY_SIZE(dmm32at_boards), +}; +module_comedi_driver(dmm32at_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); |