diff options
Diffstat (limited to 'drivers/staging/comedi/drivers/skel.c')
-rw-r--r-- | drivers/staging/comedi/drivers/skel.c | 109 |
1 files changed, 78 insertions, 31 deletions
diff --git a/drivers/staging/comedi/drivers/skel.c b/drivers/staging/comedi/drivers/skel.c index 490753b3d904..0b9ecb19511e 100644 --- a/drivers/staging/comedi/drivers/skel.c +++ b/drivers/staging/comedi/drivers/skel.c @@ -39,28 +39,28 @@ Configuration Options: * The previous block comment is used to automatically generate * documentation in Comedi and Comedilib. The fields: * - * Driver: the name of the driver - * Description: a short phrase describing the driver. Don't list boards. - * Devices: a full list of the boards that attempt to be supported by - * the driver. Format is "(manufacturer) board name [comedi name]", - * where comedi_name is the name that is used to configure the board. - * See the comment near board_name: in the struct comedi_driver structure - * below. If (manufacturer) or [comedi name] is missing, the previous - * value is used. - * Author: you - * Updated: date when the _documentation_ was last updated. Use 'date -R' - * to get a value for this. - * Status: a one-word description of the status. Valid values are: - * works - driver works correctly on most boards supported, and - * passes comedi_test. - * unknown - unknown. Usually put there by ds. - * experimental - may not work in any particular release. Author - * probably wants assistance testing it. - * bitrotten - driver has not been update in a long time, probably - * doesn't work, and probably is missing support for significant - * Comedi interface features. - * untested - author probably wrote it "blind", and is believed to - * work, but no confirmation. + * Driver: the name of the driver + * Description: a short phrase describing the driver. Don't list boards. + * Devices: a full list of the boards that attempt to be supported by + * the driver. Format is "(manufacturer) board name [comedi name]", + * where comedi_name is the name that is used to configure the board. + * See the comment near board_name: in the struct comedi_driver structure + * below. If (manufacturer) or [comedi name] is missing, the previous + * value is used. + * Author: you + * Updated: date when the _documentation_ was last updated. Use 'date -R' + * to get a value for this. + * Status: a one-word description of the status. Valid values are: + * works - driver works correctly on most boards supported, and + * passes comedi_test. + * unknown - unknown. Usually put there by ds. + * experimental - may not work in any particular release. Author + * probably wants assistance testing it. + * bitrotten - driver has not been update in a long time, probably + * doesn't work, and probably is missing support for significant + * Comedi interface features. + * untested - author probably wrote it "blind", and is believed to + * work, but no confirmation. * * These headers should be followed by a blank line, and any comments * you wish to say about the driver. The comment area is the place @@ -620,12 +620,59 @@ static int skel_dio_insn_config(struct comedi_device *dev, return insn->n; } -/* - * A convenient macro that defines init_module() and cleanup_module(), - * as necessary. - */ -COMEDI_INITCLEANUP(driver_skel); -/* If you are writing a PCI driver you should use COMEDI_PCI_INITCLEANUP - * instead. - */ -/* COMEDI_PCI_INITCLEANUP(driver_skel, skel_pci_table) */ +#ifdef CONFIG_COMEDI_PCI +static int __devinit driver_skel_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, driver_skel.driver_name); +} + +static void __devexit driver_skel_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static struct pci_driver driver_skel_pci_driver = { + .id_table = skel_pci_table, + .probe = &driver_skel_pci_probe, + .remove = __devexit_p(&driver_skel_pci_remove) +}; + +static int __init driver_skel_init_module(void) +{ + int retval; + + retval = comedi_driver_register(&driver_skel); + if (retval < 0) + return retval; + + driver_skel_pci_driver.name = (char *)driver_skel.driver_name; + return pci_register_driver(&driver_skel_pci_driver); +} + +static void __exit driver_skel_cleanup_module(void) +{ + pci_unregister_driver(&driver_skel_pci_driver); + comedi_driver_unregister(&driver_skel); +} + +module_init(driver_skel_init_module); +module_exit(driver_skel_cleanup_module); +#else +static int __init driver_skel_init_module(void) +{ + return comedi_driver_register(&driver_skel); +} + +static void __exit driver_skel_cleanup_module(void) +{ + comedi_driver_unregister(&driver_skel); +} + +module_init(driver_skel_init_module); +module_exit(driver_skel_cleanup_module); +#endif + +MODULE_AUTHOR("Comedi http://www.comedi.org"); +MODULE_DESCRIPTION("Comedi low-level driver"); +MODULE_LICENSE("GPL"); |