Staging: comedi: jr3_pci.c: add required includes
[safe/jmp/linux-2.6] / drivers / staging / comedi / drivers / aio_aio12_8.c
index 3a326f6..72283ae 100644 (file)
@@ -71,46 +71,46 @@ Notes:
 
 #define DAC_ENABLE                     0x18
 
-typedef struct {
+struct aio12_8_boardtype {
        const char *name;
-} board_type;
+};
 
-static const board_type board_types[] = {
+static const struct aio12_8_boardtype board_types[] = {
        {
-      name:    "aio_aio12_8"},
+       .name = "aio_aio12_8"},
 };
 
-#define        thisboard       ((const board_type *) dev->board_ptr)
+#define        thisboard       ((const struct aio12_8_boardtype  *) dev->board_ptr)
 
-typedef struct {
+struct aio12_8_private {
        unsigned int ao_readback[4];
-} aio12_8_private;
+};
 
-#define devpriv        ((aio12_8_private *) dev->private)
+#define devpriv        ((struct aio12_8_private *) dev->private)
 
-static int aio_aio12_8_ai_read(comedi_device * dev, comedi_subdevice * s,
-       comedi_insn * insn, unsigned int * data)
+static int aio_aio12_8_ai_read(struct comedi_device *dev, struct comedi_subdevice *s,
+       struct comedi_insn *insn, unsigned int *data)
 {
        int n;
        unsigned char control =
                ADC_MODE_NORMAL |
                (CR_RANGE(insn->chanspec) << 3) | CR_CHAN(insn->chanspec);
 
-       //read status to clear EOC latch
+       /* read status to clear EOC latch */
        inb(dev->iobase + AIO12_8_STATUS);
 
        for (n = 0; n < insn->n; n++) {
                int timeout = 5;
 
-               // Setup and start conversion
+               /*  Setup and start conversion */
                outb(control, dev->iobase + AIO12_8_ADC);
 
-               // Wait for conversion to complete
+               /*  Wait for conversion to complete */
                while (timeout &&
                        !(inb(dev->iobase + AIO12_8_STATUS) & STATUS_ADC_EOC)) {
                        timeout--;
                        printk("timeout %d\n", timeout);
-                       comedi_udelay(1);
+                       udelay(1);
                }
                if (timeout == 0) {
                        comedi_error(dev, "ADC timeout");
@@ -122,8 +122,8 @@ static int aio_aio12_8_ai_read(comedi_device * dev, comedi_subdevice * s,
        return n;
 }
 
-static int aio_aio12_8_ao_read(comedi_device * dev, comedi_subdevice * s,
-       comedi_insn * insn, unsigned int * data)
+static int aio_aio12_8_ao_read(struct comedi_device *dev, struct comedi_subdevice *s,
+       struct comedi_insn *insn, unsigned int *data)
 {
        int i;
        int val = devpriv->ao_readback[CR_CHAN(insn->chanspec)];
@@ -133,25 +133,25 @@ static int aio_aio12_8_ao_read(comedi_device * dev, comedi_subdevice * s,
        return insn->n;
 }
 
-static int aio_aio12_8_ao_write(comedi_device * dev, comedi_subdevice * s,
-       comedi_insn * insn, unsigned int * data)
+static int aio_aio12_8_ao_write(struct comedi_device *dev, struct comedi_subdevice *s,
+       struct comedi_insn *insn, unsigned int *data)
 {
        int i;
        int chan = CR_CHAN(insn->chanspec);
        unsigned long port = dev->iobase + AIO12_8_DAC_0 + (2 * chan);
 
-       //enable DACs
+       /* enable DACs */
        outb(0x01, dev->iobase + DAC_ENABLE);
 
        for (i = 0; i < insn->n; i++) {
-               outb(data[i] & 0xFF, port);     // LSB
-               outb((data[i] >> 8) & 0x0F, port + 1);  // MSB
+               outb(data[i] & 0xFF, port);     /*  LSB */
+               outb((data[i] >> 8) & 0x0F, port + 1);  /*  MSB */
                devpriv->ao_readback[chan] = data[i];
        }
        return insn->n;
 }
 
-static const comedi_lrange range_aio_aio12_8 = {
+static const struct comedi_lrange range_aio_aio12_8 = {
        4,
        {
                        UNI_RANGE(5),
@@ -161,10 +161,10 @@ static const comedi_lrange range_aio_aio12_8 = {
                }
 };
 
-static int aio_aio12_8_attach(comedi_device * dev, comedi_devconfig * it)
+static int aio_aio12_8_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
        int iobase;
-       comedi_subdevice *s;
+       struct comedi_subdevice *s;
 
        iobase = it->options[0];
        if (!request_region(iobase, 24, "aio_aio12_8")) {
@@ -176,7 +176,7 @@ static int aio_aio12_8_attach(comedi_device * dev, comedi_devconfig * it)
 
        dev->iobase = iobase;
 
-       if (alloc_private(dev, sizeof(aio12_8_private)) < 0)
+       if (alloc_private(dev, sizeof(struct aio12_8_private)) < 0)
                return -ENOMEM;
 
        if (alloc_subdevices(dev, 3) < 0)
@@ -205,7 +205,7 @@ static int aio_aio12_8_attach(comedi_device * dev, comedi_devconfig * it)
        return 0;
 }
 
-static int aio_aio12_8_detach(comedi_device * dev)
+static int aio_aio12_8_detach(struct comedi_device *dev)
 {
        subdev_8255_cleanup(dev, &dev->subdevices[2]);
        if (dev->iobase)
@@ -213,14 +213,14 @@ static int aio_aio12_8_detach(comedi_device * dev)
        return 0;
 }
 
-static comedi_driver driver_aio_aio12_8 = {
-      driver_name:"aio_aio12_8",
-      module:THIS_MODULE,
-      attach:aio_aio12_8_attach,
-      detach:aio_aio12_8_detach,
-      board_name:&board_types[0].name,
-      num_names:1,
-      offset:sizeof(board_type),
+static struct comedi_driver driver_aio_aio12_8 = {
+       .driver_name = "aio_aio12_8",
+       .module = THIS_MODULE,
+       .attach = aio_aio12_8_attach,
+       .detach = aio_aio12_8_detach,
+       .board_name = &board_types[0].name,
+       .num_names = 1,
+       .offset = sizeof(struct aio12_8_boardtype),
 };
 
 COMEDI_INITCLEANUP(driver_aio_aio12_8);