Commit 2396472f authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: refactor ii_pci20kc driver and use module_comedi_driver

Move the module_init/module_exit routines and the associated
struct comedi_drive to the end of the source. This is more
typical of how other drivers are written and removes the need
for the forward declarations.

Convert the driver to use the module_comedi_driver() macro
which makes the code smaller and a bit simpler.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cb4c516c
...@@ -159,17 +159,6 @@ struct pci20xxx_private { ...@@ -159,17 +159,6 @@ struct pci20xxx_private {
#define devpriv ((struct pci20xxx_private *)dev->private) #define devpriv ((struct pci20xxx_private *)dev->private)
#define CHAN (CR_CHAN(it->chanlist[0])) #define CHAN (CR_CHAN(it->chanlist[0]))
static int pci20xxx_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int pci20xxx_detach(struct comedi_device *dev);
static struct comedi_driver driver_pci20xxx = {
.driver_name = "ii_pci20kc",
.module = THIS_MODULE,
.attach = pci20xxx_attach,
.detach = pci20xxx_detach,
};
static int pci20006_init(struct comedi_device *dev, struct comedi_subdevice *s, static int pci20006_init(struct comedi_device *dev, struct comedi_subdevice *s,
int opt0, int opt1); int opt0, int opt1);
static int pci20341_init(struct comedi_device *dev, struct comedi_subdevice *s, static int pci20341_init(struct comedi_device *dev, struct comedi_subdevice *s,
...@@ -666,18 +655,13 @@ static unsigned int pci20xxx_di(struct comedi_device *dev, ...@@ -666,18 +655,13 @@ static unsigned int pci20xxx_di(struct comedi_device *dev,
} }
#endif #endif
static int __init driver_pci20xxx_init_module(void) static struct comedi_driver pci20xxx_driver = {
{ .driver_name = "ii_pci20kc",
return comedi_driver_register(&driver_pci20xxx); .module = THIS_MODULE,
} .attach = pci20xxx_attach,
.detach = pci20xxx_detach,
static void __exit driver_pci20xxx_cleanup_module(void) };
{ module_comedi_driver(pci20xxx_driver);
comedi_driver_unregister(&driver_pci20xxx);
}
module_init(driver_pci20xxx_init_module);
module_exit(driver_pci20xxx_cleanup_module);
MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_AUTHOR("Comedi http://www.comedi.org");
MODULE_DESCRIPTION("Comedi low-level driver"); MODULE_DESCRIPTION("Comedi low-level driver");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment