diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2012-04-23 14:50:39 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-24 11:38:36 -0700 |
commit | 1b18bbb580e96af4e12788fcc1758f68a5cebf86 (patch) | |
tree | b11d8bd1f0dbde2e55214d386806680a15a32252 | |
parent | c8d87bcc2263401e60c08611e16e6a6481f29ef4 (diff) | |
download | linux-3.10-1b18bbb580e96af4e12788fcc1758f68a5cebf86.tar.gz linux-3.10-1b18bbb580e96af4e12788fcc1758f68a5cebf86.tar.bz2 linux-3.10-1b18bbb580e96af4e12788fcc1758f68a5cebf86.zip |
staging: comedi: refactor the acl7225b driver to remove the forward declarations
Move the module_init/module_exit routines and the associated
struct comedi_driver and struct boardtype variables to the end
of the source. This is more typical of how other drivers are
written and removes the need to the forward declarations.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/acl7225b.c | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/drivers/staging/comedi/drivers/acl7225b.c b/drivers/staging/comedi/drivers/acl7225b.c index f4a301a5aec..ef685fc49b4 100644 --- a/drivers/staging/comedi/drivers/acl7225b.c +++ b/drivers/staging/comedi/drivers/acl7225b.c @@ -22,45 +22,13 @@ Devices: [Adlink] ACL-7225b (acl7225b), [ICP] P16R16DIO (p16r16dio) #define ACL7225_DI_LO 2 /* Digital input low byte (DI0-DI7) */ #define ACL7225_DI_HI 3 /* Digital input high byte (DI8-DI15) */ -static int acl7225b_attach(struct comedi_device *dev, - struct comedi_devconfig *it); -static int acl7225b_detach(struct comedi_device *dev); - struct boardtype { const char *name; /* driver name */ int io_range; /* len of I/O space */ }; -static const struct boardtype boardtypes[] = { - {"acl7225b", ACL7225_SIZE,}, - {"p16r16dio", P16R16DIO_SIZE,}, -}; - #define this_board ((const struct boardtype *)dev->board_ptr) -static struct comedi_driver driver_acl7225b = { - .driver_name = "acl7225b", - .module = THIS_MODULE, - .attach = acl7225b_attach, - .detach = acl7225b_detach, - .board_name = &boardtypes[0].name, - .num_names = ARRAY_SIZE(boardtypes), - .offset = sizeof(struct boardtype), -}; - -static int __init driver_acl7225b_init_module(void) -{ - return comedi_driver_register(&driver_acl7225b); -} - -static void __exit driver_acl7225b_cleanup_module(void) -{ - comedi_driver_unregister(&driver_acl7225b); -} - -module_init(driver_acl7225b_init_module); -module_exit(driver_acl7225b_cleanup_module); - static int acl7225b_do_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -161,6 +129,33 @@ static int acl7225b_detach(struct comedi_device *dev) return 0; } +static const struct boardtype boardtypes[] = { + { "acl7225b", ACL7225_SIZE, }, + { "p16r16dio", P16R16DIO_SIZE, }, +}; + +static struct comedi_driver driver_acl7225b = { + .driver_name = "acl7225b", + .module = THIS_MODULE, + .attach = acl7225b_attach, + .detach = acl7225b_detach, + .board_name = &boardtypes[0].name, + .num_names = ARRAY_SIZE(boardtypes), + .offset = sizeof(struct boardtype), +}; + +static int __init driver_acl7225b_init_module(void) +{ + return comedi_driver_register(&driver_acl7225b); +} +module_init(driver_acl7225b_init_module); + +static void __exit driver_acl7225b_cleanup_module(void) +{ + comedi_driver_unregister(&driver_acl7225b); +} +module_exit(driver_acl7225b_cleanup_module); + MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); MODULE_LICENSE("GPL"); |