staging: comedi: refactor aio_iiro_16 driver to remove forward declarations
authorH Hartley Sweeten <hartleys@visionengravers.com>
Mon, 23 Apr 2012 23:13:43 +0000 (16:13 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Apr 2012 18:38:35 +0000 (11:38 -0700)
Move the struct comedi_driver variable and the associated
attach/detach routines to remove 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>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/aio_iiro_16.c

index 160b0a0f4f1ed1d3f21c57a82f2ed61e0223fb9d..763461a569aa6ea170ed0fb6a8c3b3261d6bca50 100644 (file)
@@ -67,30 +67,41 @@ struct aio_iiro_16_private {
 
 #define        devpriv ((struct aio_iiro_16_private *) dev->private)
 
-static int aio_iiro_16_attach(struct comedi_device *dev,
-                             struct comedi_devconfig *it);
+static int aio_iiro_16_dio_insn_bits_write(struct comedi_device *dev,
+                                          struct comedi_subdevice *s,
+                                          struct comedi_insn *insn,
+                                          unsigned int *data)
+{
+       if (insn->n != 2)
+               return -EINVAL;
 
-static int aio_iiro_16_detach(struct comedi_device *dev);
+       if (data[0]) {
+               s->state &= ~data[0];
+               s->state |= data[0] & data[1];
+               outb(s->state & 0xff, dev->iobase + AIO_IIRO_16_RELAY_0_7);
+               outb((s->state >> 8) & 0xff,
+                    dev->iobase + AIO_IIRO_16_RELAY_8_15);
+       }
 
-static struct comedi_driver driver_aio_iiro_16 = {
-       .driver_name = "aio_iiro_16",
-       .module = THIS_MODULE,
-       .attach = aio_iiro_16_attach,
-       .detach = aio_iiro_16_detach,
-       .board_name = &aio_iiro_16_boards[0].name,
-       .offset = sizeof(struct aio_iiro_16_board),
-       .num_names = ARRAY_SIZE(aio_iiro_16_boards),
-};
+       data[1] = s->state;
+
+       return 2;
+}
 
 static int aio_iiro_16_dio_insn_bits_read(struct comedi_device *dev,
                                          struct comedi_subdevice *s,
                                          struct comedi_insn *insn,
-                                         unsigned int *data);
+                                         unsigned int *data)
+{
+       if (insn->n != 2)
+               return -EINVAL;
 
-static int aio_iiro_16_dio_insn_bits_write(struct comedi_device *dev,
-                                          struct comedi_subdevice *s,
-                                          struct comedi_insn *insn,
-                                          unsigned int *data);
+       data[1] = 0;
+       data[1] |= inb(dev->iobase + AIO_IIRO_16_INPUT_0_7);
+       data[1] |= inb(dev->iobase + AIO_IIRO_16_INPUT_8_15) << 8;
+
+       return 2;
+}
 
 static int aio_iiro_16_attach(struct comedi_device *dev,
                              struct comedi_devconfig *it)
@@ -148,53 +159,26 @@ static int aio_iiro_16_detach(struct comedi_device *dev)
        return 0;
 }
 
-static int aio_iiro_16_dio_insn_bits_write(struct comedi_device *dev,
-                                          struct comedi_subdevice *s,
-                                          struct comedi_insn *insn,
-                                          unsigned int *data)
-{
-       if (insn->n != 2)
-               return -EINVAL;
-
-       if (data[0]) {
-               s->state &= ~data[0];
-               s->state |= data[0] & data[1];
-               outb(s->state & 0xff, dev->iobase + AIO_IIRO_16_RELAY_0_7);
-               outb((s->state >> 8) & 0xff,
-                    dev->iobase + AIO_IIRO_16_RELAY_8_15);
-       }
-
-       data[1] = s->state;
-
-       return 2;
-}
-
-static int aio_iiro_16_dio_insn_bits_read(struct comedi_device *dev,
-                                         struct comedi_subdevice *s,
-                                         struct comedi_insn *insn,
-                                         unsigned int *data)
-{
-       if (insn->n != 2)
-               return -EINVAL;
-
-       data[1] = 0;
-       data[1] |= inb(dev->iobase + AIO_IIRO_16_INPUT_0_7);
-       data[1] |= inb(dev->iobase + AIO_IIRO_16_INPUT_8_15) << 8;
-
-       return 2;
-}
+static struct comedi_driver driver_aio_iiro_16 = {
+       .driver_name    = "aio_iiro_16",
+       .module         = THIS_MODULE,
+       .attach         = aio_iiro_16_attach,
+       .detach         = aio_iiro_16_detach,
+       .board_name     = &aio_iiro_16_boards[0].name,
+       .offset         = sizeof(struct aio_iiro_16_board),
+       .num_names      = ARRAY_SIZE(aio_iiro_16_boards),
+};
 
 static int __init driver_aio_iiro_16_init_module(void)
 {
        return comedi_driver_register(&driver_aio_iiro_16);
 }
+module_init(driver_aio_iiro_16_init_module);
 
 static void __exit driver_aio_iiro_16_cleanup_module(void)
 {
        comedi_driver_unregister(&driver_aio_iiro_16);
 }
-
-module_init(driver_aio_iiro_16_init_module);
 module_exit(driver_aio_iiro_16_cleanup_module);
 
 MODULE_AUTHOR("Comedi http://www.comedi.org");