提交 bfba5e78 编写于 作者: H H Hartley Sweeten 提交者: Greg Kroah-Hartman

staging: comedi: refactor comedi_parport 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: NH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 0eb0f278
......@@ -91,29 +91,6 @@ pin, which can be used to wake up tasks.
#define PARPORT_B 1
#define PARPORT_C 2
static int parport_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int parport_detach(struct comedi_device *dev);
static struct comedi_driver driver_parport = {
.driver_name = "comedi_parport",
.module = THIS_MODULE,
.attach = parport_attach,
.detach = parport_detach,
};
static int __init driver_parport_init_module(void)
{
return comedi_driver_register(&driver_parport);
}
static void __exit driver_parport_cleanup_module(void)
{
comedi_driver_unregister(&driver_parport);
}
module_init(driver_parport_init_module);
module_exit(driver_parport_cleanup_module);
struct parport_private {
unsigned int a_data;
unsigned int c_data;
......@@ -408,6 +385,14 @@ static int parport_detach(struct comedi_device *dev)
return 0;
}
static struct comedi_driver parport_driver = {
.driver_name = "comedi_parport",
.module = THIS_MODULE,
.attach = parport_attach,
.detach = parport_detach,
};
module_comedi_driver(parport_driver);
MODULE_AUTHOR("Comedi http://www.comedi.org");
MODULE_DESCRIPTION("Comedi low-level driver");
MODULE_LICENSE("GPL");
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册