staging: comedi: refactor adl_pci9111 driver to remove forward declarations
Move the module_init/module_exit routines and variables to the end of the source as is more typically done with other drivers. Then rearrange the attach/detach and probe/remove functions, this removes the need for all 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>
This commit is contained in:
parent
632d391b35
commit
e68a83fe52
1 changed files with 51 additions and 63 deletions
|
@ -289,16 +289,6 @@ TODO:
|
|||
PCI9111_IO_BASE+PCI9111_REGISTER_8254_COUNTER_2); \
|
||||
} while (0)
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
static int pci9111_attach(struct comedi_device *dev,
|
||||
struct comedi_devconfig *it);
|
||||
static int pci9111_detach(struct comedi_device *dev);
|
||||
static void pci9111_ai_munge(struct comedi_device *dev,
|
||||
struct comedi_subdevice *s, void *data,
|
||||
unsigned int num_bytes,
|
||||
unsigned int start_chan_index);
|
||||
|
||||
static const struct comedi_lrange pci9111_hr_ai_range = {
|
||||
5,
|
||||
{
|
||||
|
@ -310,14 +300,6 @@ static const struct comedi_lrange pci9111_hr_ai_range = {
|
|||
}
|
||||
};
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(pci9111_pci_table) = {
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI9111_HR_DEVICE_ID) },
|
||||
/* { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI9111_HG_DEVICE_ID) }, */
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, pci9111_pci_table);
|
||||
|
||||
/* */
|
||||
/* Board specification structure */
|
||||
/* */
|
||||
|
@ -354,51 +336,6 @@ static const struct pci9111_board pci9111_boards[] = {
|
|||
#define pci9111_board_nbr \
|
||||
(sizeof(pci9111_boards)/sizeof(struct pci9111_board))
|
||||
|
||||
static struct comedi_driver pci9111_driver = {
|
||||
.driver_name = PCI9111_DRIVER_NAME,
|
||||
.module = THIS_MODULE,
|
||||
.attach = pci9111_attach,
|
||||
.detach = pci9111_detach,
|
||||
};
|
||||
|
||||
static int __devinit pci9111_driver_pci_probe(struct pci_dev *dev,
|
||||
const struct pci_device_id *ent)
|
||||
{
|
||||
return comedi_pci_auto_config(dev, &pci9111_driver);
|
||||
}
|
||||
|
||||
static void __devexit pci9111_driver_pci_remove(struct pci_dev *dev)
|
||||
{
|
||||
comedi_pci_auto_unconfig(dev);
|
||||
}
|
||||
|
||||
static struct pci_driver pci9111_driver_pci_driver = {
|
||||
.id_table = pci9111_pci_table,
|
||||
.probe = &pci9111_driver_pci_probe,
|
||||
.remove = __devexit_p(&pci9111_driver_pci_remove)
|
||||
};
|
||||
|
||||
static int __init pci9111_driver_init_module(void)
|
||||
{
|
||||
int retval;
|
||||
|
||||
retval = comedi_driver_register(&pci9111_driver);
|
||||
if (retval < 0)
|
||||
return retval;
|
||||
|
||||
pci9111_driver_pci_driver.name = (char *)pci9111_driver.driver_name;
|
||||
return pci_register_driver(&pci9111_driver_pci_driver);
|
||||
}
|
||||
|
||||
static void __exit pci9111_driver_cleanup_module(void)
|
||||
{
|
||||
pci_unregister_driver(&pci9111_driver_pci_driver);
|
||||
comedi_driver_unregister(&pci9111_driver);
|
||||
}
|
||||
|
||||
module_init(pci9111_driver_init_module);
|
||||
module_exit(pci9111_driver_cleanup_module);
|
||||
|
||||
/* Private data structure */
|
||||
|
||||
struct pci9111_private_data {
|
||||
|
@ -1470,6 +1407,57 @@ static int pci9111_detach(struct comedi_device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct comedi_driver pci9111_driver = {
|
||||
.driver_name = PCI9111_DRIVER_NAME,
|
||||
.module = THIS_MODULE,
|
||||
.attach = pci9111_attach,
|
||||
.detach = pci9111_detach,
|
||||
};
|
||||
|
||||
static int __devinit pci9111_driver_pci_probe(struct pci_dev *dev,
|
||||
const struct pci_device_id *ent)
|
||||
{
|
||||
return comedi_pci_auto_config(dev, &pci9111_driver);
|
||||
}
|
||||
|
||||
static void __devexit pci9111_driver_pci_remove(struct pci_dev *dev)
|
||||
{
|
||||
comedi_pci_auto_unconfig(dev);
|
||||
}
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(pci9111_pci_table) = {
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI9111_HR_DEVICE_ID) },
|
||||
/* { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI9111_HG_DEVICE_ID) }, */
|
||||
{ 0 }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(pci, pci9111_pci_table);
|
||||
|
||||
static struct pci_driver pci9111_driver_pci_driver = {
|
||||
.id_table = pci9111_pci_table,
|
||||
.probe = pci9111_driver_pci_probe,
|
||||
.remove = __devexit_p(pci9111_driver_pci_remove),
|
||||
};
|
||||
|
||||
static int __init pci9111_driver_init_module(void)
|
||||
{
|
||||
int retval;
|
||||
|
||||
retval = comedi_driver_register(&pci9111_driver);
|
||||
if (retval < 0)
|
||||
return retval;
|
||||
|
||||
pci9111_driver_pci_driver.name = (char *)pci9111_driver.driver_name;
|
||||
return pci_register_driver(&pci9111_driver_pci_driver);
|
||||
}
|
||||
module_init(pci9111_driver_init_module);
|
||||
|
||||
static void __exit pci9111_driver_cleanup_module(void)
|
||||
{
|
||||
pci_unregister_driver(&pci9111_driver_pci_driver);
|
||||
comedi_driver_unregister(&pci9111_driver);
|
||||
}
|
||||
module_exit(pci9111_driver_cleanup_module);
|
||||
|
||||
MODULE_AUTHOR("Comedi http://www.comedi.org");
|
||||
MODULE_DESCRIPTION("Comedi low-level driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
Loading…
Reference in a new issue