diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2012-04-27 22:09:49 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-30 01:42:54 (GMT) |
commit | 6beb8160ea04a7891d5102f86104f75c0db05d15 (patch) | |
tree | bd3cbc25a53c2221caff720495adaf602c67dc07 /drivers/staging | |
parent | 9a644c40a3f4165d4c03ba52f70e9f0488f4c993 (diff) | |
download | linux-fsl-qoriq-6beb8160ea04a7891d5102f86104f75c0db05d15.tar.xz |
staging: comedi: partial refactor of the rtd520 driver to remove forward declarations
Move the struct comedi_driver MODULE_DEVICE_TABLE to the end
of the source. The attach and detach functions are not moved yet
because patch is pretty messy and not reviewable. This is more
typical of how other drivers are written and removes the need for
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/comedi/drivers/rtd520.c | 51 |
1 files changed, 18 insertions, 33 deletions
diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 0b7ff76..1559d57 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -328,14 +328,6 @@ static const struct rtdBoard rtd520Boards[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(rtd520_pci_table) = { - { PCI_DEVICE(PCI_VENDOR_ID_RTD, 0x7520) }, - { PCI_DEVICE(PCI_VENDOR_ID_RTD, 0x4520) }, - { 0 } -}; - -MODULE_DEVICE_TABLE(pci, rtd520_pci_table); - /* * Useful for shorthand access to the particular board structure */ @@ -705,22 +697,6 @@ struct rtdPrivate { #define RtdDma1Status(dev) \ readb(devpriv->lcfg+LCFG_DMACSR1) -/* - * The struct comedi_driver structure tells the Comedi core module - * which functions to call to configure/deconfigure (attac/detach) - * the board, and also about the kernel module that contains - * the device code. - */ -static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it); -static int rtd_detach(struct comedi_device *dev); - -static struct comedi_driver rtd520Driver = { - .driver_name = DRV_NAME, - .module = THIS_MODULE, - .attach = rtd_attach, - .detach = rtd_detach, -}; - static int rtd_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); static int rtd_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, @@ -2348,10 +2324,13 @@ static int rtd_dio_insn_config(struct comedi_device *dev, return 1; } -/* - * A convenient macro that defines init_module() and cleanup_module(), - * as necessary. - */ +static struct comedi_driver rtd520Driver = { + .driver_name = DRV_NAME, + .module = THIS_MODULE, + .attach = rtd_attach, + .detach = rtd_detach, +}; + static int __devinit rtd520Driver_pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) { @@ -2363,10 +2342,17 @@ static void __devexit rtd520Driver_pci_remove(struct pci_dev *dev) comedi_pci_auto_unconfig(dev); } +static DEFINE_PCI_DEVICE_TABLE(rtd520_pci_table) = { + { PCI_DEVICE(PCI_VENDOR_ID_RTD, 0x7520) }, + { PCI_DEVICE(PCI_VENDOR_ID_RTD, 0x4520) }, + { 0 } +}; +MODULE_DEVICE_TABLE(pci, rtd520_pci_table); + static struct pci_driver rtd520Driver_pci_driver = { - .id_table = rtd520_pci_table, - .probe = &rtd520Driver_pci_probe, - .remove = __devexit_p(&rtd520Driver_pci_remove) + .id_table = rtd520_pci_table, + .probe = &rtd520Driver_pci_probe, + .remove = __devexit_p(&rtd520Driver_pci_remove) }; static int __init rtd520Driver_init_module(void) @@ -2380,14 +2366,13 @@ static int __init rtd520Driver_init_module(void) rtd520Driver_pci_driver.name = (char *)rtd520Driver.driver_name; return pci_register_driver(&rtd520Driver_pci_driver); } +module_init(rtd520Driver_init_module); static void __exit rtd520Driver_cleanup_module(void) { pci_unregister_driver(&rtd520Driver_pci_driver); comedi_driver_unregister(&rtd520Driver); } - -module_init(rtd520Driver_init_module); module_exit(rtd520Driver_cleanup_module); MODULE_AUTHOR("Comedi http://www.comedi.org"); |