]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
staging: comedi: refactor adl_pci9111 driver to remove forward declarations
authorH Hartley Sweeten <hartleys@visionengravers.com>
Mon, 23 Apr 2012 22:43:22 +0000 (15:43 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Apr 2012 18:38:35 +0000 (11:38 -0700)
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>
drivers/staging/comedi/drivers/adl_pci9111.c

index 6b4d98ab450e56504661f3d34a8dd9333e31894e..4e4e5fdcda371d01dc1fb797885880c75dffc2fc 100644 (file)
@@ -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");