diff options
Diffstat (limited to 'drivers/staging/comedi/drivers/amplc_pci224.c')
-rw-r--r-- | drivers/staging/comedi/drivers/amplc_pci224.c | 260 |
1 files changed, 137 insertions, 123 deletions
diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index d1a64e80cdd..d9836879355 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -283,15 +283,15 @@ Caveats: static const struct comedi_lrange range_pci224_internal = { 8, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25), - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25), + } }; static const unsigned short hwrange_pci224_internal[8] = { @@ -309,9 +309,9 @@ static const unsigned short hwrange_pci224_internal[8] = { static const struct comedi_lrange range_pci224_external = { 2, { - RANGE_ext(-1, 1), /* bipolar [-Vref,+Vref] */ - RANGE_ext(0, 1), /* unipolar [0,+Vref] */ - } + RANGE_ext(-1, 1), /* bipolar [-Vref,+Vref] */ + RANGE_ext(0, 1), /* unipolar [0,+Vref] */ + } }; static const unsigned short hwrange_pci224_external[2] = { @@ -324,8 +324,8 @@ static const unsigned short hwrange_pci224_external[2] = { static const struct comedi_lrange range_pci234_ext2 = { 1, { - RANGE_ext(-2, 2), - } + RANGE_ext(-2, 2), + } }; /* The hardware selectable Vref external range for PCI234 @@ -333,8 +333,8 @@ static const struct comedi_lrange range_pci234_ext2 = { static const struct comedi_lrange range_pci234_ext = { 1, { - RANGE_ext(-1, 1), - } + RANGE_ext(-1, 1), + } }; /* This serves for all the PCI234 ranges. */ @@ -358,24 +358,24 @@ struct pci224_board { static const struct pci224_board pci224_boards[] = { { - .name = "pci224", - .devid = PCI_DEVICE_ID_AMPLICON_PCI224, - .model = pci224_model, - .ao_chans = 16, - .ao_bits = 12, - }, + .name = "pci224", + .devid = PCI_DEVICE_ID_AMPLICON_PCI224, + .model = pci224_model, + .ao_chans = 16, + .ao_bits = 12, + }, { - .name = "pci234", - .devid = PCI_DEVICE_ID_AMPLICON_PCI234, - .model = pci234_model, - .ao_chans = 4, - .ao_bits = 16, - }, + .name = "pci234", + .devid = PCI_DEVICE_ID_AMPLICON_PCI234, + .model = pci234_model, + .ao_chans = 4, + .ao_bits = 16, + }, { - .name = DRIVER_NAME, - .devid = PCI_DEVICE_ID_INVALID, - .model = any_model, /* wildcard */ - }, + .name = DRIVER_NAME, + .devid = PCI_DEVICE_ID_INVALID, + .model = any_model, /* wildcard */ + }, }; /* @@ -383,11 +383,12 @@ static const struct pci224_board pci224_boards[] = { */ static DEFINE_PCI_DEVICE_TABLE(pci224_pci_table) = { - {PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI224, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI234, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0} + { + PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI224, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { + PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI234, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { + 0} }; MODULE_DEVICE_TABLE(pci, pci224_pci_table); @@ -428,7 +429,8 @@ struct pci224_private { * the board, and also about the kernel module that contains * the device code. */ -static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it); +static int pci224_attach(struct comedi_device *dev, + struct comedi_devconfig *it); static int pci224_detach(struct comedi_device *dev); static struct comedi_driver driver_amplc_pci224 = { .driver_name = DRIVER_NAME, @@ -446,7 +448,8 @@ COMEDI_PCI_INITCLEANUP(driver_amplc_pci224, pci224_pci_table); * Called from the 'insn_write' function to perform a single write. */ static void -pci224_ao_set_data(struct comedi_device *dev, int chan, int range, unsigned int data) +pci224_ao_set_data(struct comedi_device *dev, int chan, int range, + unsigned int data) { unsigned short mangled; @@ -456,9 +459,10 @@ pci224_ao_set_data(struct comedi_device *dev, int chan, int range, unsigned int outw(1 << chan, dev->iobase + PCI224_DACCEN); /* Set range and reset FIFO. */ devpriv->daccon = COMBINE(devpriv->daccon, devpriv->hwrange[range], - (PCI224_DACCON_POLAR_MASK | PCI224_DACCON_VREF_MASK)); + (PCI224_DACCON_POLAR_MASK | + PCI224_DACCON_VREF_MASK)); outw(devpriv->daccon | PCI224_DACCON_FIFORESET, - dev->iobase + PCI224_DACCON); + dev->iobase + PCI224_DACCON); /* * Mangle the data. The hardware expects: * - bipolar: 16-bit 2's complement @@ -466,7 +470,7 @@ pci224_ao_set_data(struct comedi_device *dev, int chan, int range, unsigned int */ mangled = (unsigned short)data << (16 - thisboard->ao_bits); if ((devpriv->daccon & PCI224_DACCON_POLAR_MASK) == - PCI224_DACCON_POLAR_BI) { + PCI224_DACCON_POLAR_BI) { mangled ^= 0x8000; } /* Write mangled data to the FIFO. */ @@ -480,7 +484,7 @@ pci224_ao_set_data(struct comedi_device *dev, int chan, int range, unsigned int */ static int pci224_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int i; int chan, range; @@ -507,7 +511,7 @@ pci224_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, */ static int pci224_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int i; int chan; @@ -526,7 +530,7 @@ pci224_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, */ static void pci224_cascade_ns_to_timer(int osc_base, unsigned int *d1, unsigned int *d2, - unsigned int *nanosec, int round_mode) + unsigned int *nanosec, int round_mode) { i8253_cascade_ns_to_timer(osc_base, d1, d2, nanosec, round_mode); } @@ -534,7 +538,8 @@ pci224_cascade_ns_to_timer(int osc_base, unsigned int *d1, unsigned int *d2, /* * Kills a command running on the AO subdevice. */ -static void pci224_ao_stop(struct comedi_device *dev, struct comedi_subdevice *s) +static void pci224_ao_stop(struct comedi_device *dev, + struct comedi_subdevice *s) { unsigned long flags; @@ -565,16 +570,19 @@ static void pci224_ao_stop(struct comedi_device *dev, struct comedi_subdevice *s /* Reconfigure DAC for insn_write usage. */ outw(0, dev->iobase + PCI224_DACCEN); /* Disable channels. */ devpriv->daccon = COMBINE(devpriv->daccon, - PCI224_DACCON_TRIG_SW | PCI224_DACCON_FIFOINTR_EMPTY, - PCI224_DACCON_TRIG_MASK | PCI224_DACCON_FIFOINTR_MASK); + PCI224_DACCON_TRIG_SW | + PCI224_DACCON_FIFOINTR_EMPTY, + PCI224_DACCON_TRIG_MASK | + PCI224_DACCON_FIFOINTR_MASK); outw(devpriv->daccon | PCI224_DACCON_FIFORESET, - dev->iobase + PCI224_DACCON); + dev->iobase + PCI224_DACCON); } /* * Handles start of acquisition for the AO subdevice. */ -static void pci224_ao_start(struct comedi_device *dev, struct comedi_subdevice *s) +static void pci224_ao_start(struct comedi_device *dev, + struct comedi_subdevice *s) { struct comedi_cmd *cmd = &s->async->cmd; unsigned long flags; @@ -601,7 +609,8 @@ static void pci224_ao_start(struct comedi_device *dev, struct comedi_subdevice * /* * Handles interrupts from the DAC FIFO. */ -static void pci224_ao_handle_fifo(struct comedi_device *dev, struct comedi_subdevice *s) +static void pci224_ao_handle_fifo(struct comedi_device *dev, + struct comedi_subdevice *s) { struct comedi_cmd *cmd = &s->async->cmd; unsigned int num_scans; @@ -630,8 +639,7 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, struct comedi_subde switch (dacstat & PCI224_DACCON_FIFOFL_MASK) { case PCI224_DACCON_FIFOFL_EMPTY: room = PCI224_FIFO_ROOM_EMPTY; - if (!devpriv->ao_stop_continuous - && devpriv->ao_stop_count == 0) { + if (!devpriv->ao_stop_continuous && devpriv->ao_stop_count == 0) { /* FIFO empty at end of counted acquisition. */ pci224_ao_stop(dev, s); s->async->events |= COMEDI_CB_EOA; @@ -656,7 +664,7 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, struct comedi_subde pci224_ao_stop(dev, s); s->async->events |= COMEDI_CB_OVERFLOW; printk(KERN_ERR "comedi%d: " - "AO buffer underrun\n", dev->minor); + "AO buffer underrun\n", dev->minor); } } /* Determine how many new scans can be put in the FIFO. */ @@ -670,11 +678,10 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, struct comedi_subde /* Process scans. */ for (n = 0; n < num_scans; n++) { cfc_read_array_from_buffer(s, &devpriv->ao_scan_vals[0], - bytes_per_scan); + bytes_per_scan); for (i = 0; i < cmd->chanlist_len; i++) { - outw(devpriv->ao_scan_vals[devpriv-> - ao_scan_order[i]], - dev->iobase + PCI224_DACDATA); + outw(devpriv->ao_scan_vals[devpriv->ao_scan_order[i]], + dev->iobase + PCI224_DACDATA); } } if (!devpriv->ao_stop_continuous) { @@ -685,14 +692,13 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, struct comedi_subde * until FIFO is empty. */ devpriv->daccon = COMBINE(devpriv->daccon, - PCI224_DACCON_FIFOINTR_EMPTY, - PCI224_DACCON_FIFOINTR_MASK); - outw(devpriv->daccon, - dev->iobase + PCI224_DACCON); + PCI224_DACCON_FIFOINTR_EMPTY, + PCI224_DACCON_FIFOINTR_MASK); + outw(devpriv->daccon, dev->iobase + PCI224_DACCON); } } if ((devpriv->daccon & PCI224_DACCON_TRIG_MASK) == - PCI224_DACCON_TRIG_NONE) { + PCI224_DACCON_TRIG_NONE) { unsigned short trig; /* @@ -718,7 +724,7 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, struct comedi_subde } } devpriv->daccon = COMBINE(devpriv->daccon, trig, - PCI224_DACCON_TRIG_MASK); + PCI224_DACCON_TRIG_MASK); outw(devpriv->daccon, dev->iobase + PCI224_DACCON); } if (s->async->events) { @@ -731,7 +737,7 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, struct comedi_subde */ static int pci224_ao_inttrig_start(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned int trignum) + unsigned int trignum) { if (trignum != 0) return -EINVAL; @@ -750,7 +756,8 @@ pci224_ao_inttrig_start(struct comedi_device *dev, struct comedi_subdevice *s, * 'do_cmdtest' function for AO subdevice. */ static int -pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) +pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_cmd *cmd) { int err = 0; unsigned int tmp; @@ -828,13 +835,13 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct /* Force to external trigger 0. */ if ((cmd->start_arg & ~CR_FLAGS_MASK) != 0) { cmd->start_arg = COMBINE(cmd->start_arg, 0, - ~CR_FLAGS_MASK); + ~CR_FLAGS_MASK); err++; } /* The only flag allowed is CR_EDGE, which is ignored. */ if ((cmd->start_arg & CR_FLAGS_MASK & ~CR_EDGE) != 0) { cmd->start_arg = COMBINE(cmd->start_arg, 0, - CR_FLAGS_MASK & ~CR_EDGE); + CR_FLAGS_MASK & ~CR_EDGE); err++; } break; @@ -859,14 +866,16 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct /* Force to external trigger 0. */ if ((cmd->scan_begin_arg & ~CR_FLAGS_MASK) != 0) { cmd->scan_begin_arg = COMBINE(cmd->scan_begin_arg, 0, - ~CR_FLAGS_MASK); + ~CR_FLAGS_MASK); err++; } /* Only allow flags CR_EDGE and CR_INVERT. Ignore CR_EDGE. */ if ((cmd->scan_begin_arg & CR_FLAGS_MASK & - ~(CR_EDGE | CR_INVERT)) != 0) { + ~(CR_EDGE | CR_INVERT)) != 0) { cmd->scan_begin_arg = COMBINE(cmd->scan_begin_arg, 0, - CR_FLAGS_MASK & ~(CR_EDGE | CR_INVERT)); + CR_FLAGS_MASK & ~(CR_EDGE + | + CR_INVERT)); err++; } break; @@ -892,13 +901,13 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct /* Force to external trigger 0. */ if ((cmd->stop_arg & ~CR_FLAGS_MASK) != 0) { cmd->stop_arg = COMBINE(cmd->stop_arg, 0, - ~CR_FLAGS_MASK); + ~CR_FLAGS_MASK); err++; } /* The only flag allowed is CR_EDGE, which is ignored. */ if ((cmd->stop_arg & CR_FLAGS_MASK & ~CR_EDGE) != 0) { cmd->stop_arg = COMBINE(cmd->stop_arg, 0, - CR_FLAGS_MASK & ~CR_EDGE); + CR_FLAGS_MASK & ~CR_EDGE); } break; case TRIG_NONE: @@ -935,14 +944,14 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct /* Be careful to avoid overflow! */ div2 = cmd->scan_begin_arg / TIMEBASE_10MHZ; div2 += (round + cmd->scan_begin_arg % TIMEBASE_10MHZ) / - TIMEBASE_10MHZ; + TIMEBASE_10MHZ; if (div2 <= 0x10000) { /* A single timer will suffice. */ if (div2 < 2) div2 = 2; cmd->scan_begin_arg = div2 * TIMEBASE_10MHZ; if (cmd->scan_begin_arg < div2 || - cmd->scan_begin_arg < TIMEBASE_10MHZ) { + cmd->scan_begin_arg < TIMEBASE_10MHZ) { /* Overflow! */ cmd->scan_begin_arg = MAX_SCAN_PERIOD; } @@ -951,7 +960,8 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct div1 = devpriv->cached_div1; div2 = devpriv->cached_div2; pci224_cascade_ns_to_timer(TIMEBASE_10MHZ, &div1, &div2, - &cmd->scan_begin_arg, round_mode); + &cmd->scan_begin_arg, + round_mode); devpriv->cached_div1 = div1; devpriv->cached_div2 = div2; } @@ -1061,12 +1071,15 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) * N.B. DAC FIFO interrupts are currently disabled. */ devpriv->daccon = COMBINE(devpriv->daccon, - (devpriv->hwrange[range] | PCI224_DACCON_TRIG_NONE | - PCI224_DACCON_FIFOINTR_NHALF), - (PCI224_DACCON_POLAR_MASK | PCI224_DACCON_VREF_MASK | - PCI224_DACCON_TRIG_MASK | PCI224_DACCON_FIFOINTR_MASK)); + (devpriv-> + hwrange[range] | PCI224_DACCON_TRIG_NONE | + PCI224_DACCON_FIFOINTR_NHALF), + (PCI224_DACCON_POLAR_MASK | + PCI224_DACCON_VREF_MASK | + PCI224_DACCON_TRIG_MASK | + PCI224_DACCON_FIFOINTR_MASK)); outw(devpriv->daccon | PCI224_DACCON_FIFORESET, - dev->iobase + PCI224_DACCON); + dev->iobase + PCI224_DACCON); if (cmd->scan_begin_src == TRIG_TIMER) { unsigned int div1, div2, round; @@ -1089,7 +1102,7 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* Be careful to avoid overflow! */ div2 = cmd->scan_begin_arg / TIMEBASE_10MHZ; div2 += (round + cmd->scan_begin_arg % TIMEBASE_10MHZ) / - TIMEBASE_10MHZ; + TIMEBASE_10MHZ; if (div2 <= 0x10000) { /* A single timer will suffice. */ if (div2 < 2) @@ -1101,7 +1114,7 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) div1 = devpriv->cached_div1; div2 = devpriv->cached_div2; pci224_cascade_ns_to_timer(TIMEBASE_10MHZ, &div1, &div2, - &ns, round_mode); + &ns, round_mode); } /* @@ -1110,25 +1123,25 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) */ /* Make sure Z2-0 is gated on. */ outb(GAT_CONFIG(0, GAT_VCC), - devpriv->iobase1 + PCI224_ZGAT_SCE); + devpriv->iobase1 + PCI224_ZGAT_SCE); if (div1 == 1) { /* Not cascading. Z2-0 needs 10 MHz clock. */ outb(CLK_CONFIG(0, CLK_10MHZ), - devpriv->iobase1 + PCI224_ZCLK_SCE); + devpriv->iobase1 + PCI224_ZCLK_SCE); } else { /* Cascading with Z2-2. */ /* Make sure Z2-2 is gated on. */ outb(GAT_CONFIG(2, GAT_VCC), - devpriv->iobase1 + PCI224_ZGAT_SCE); + devpriv->iobase1 + PCI224_ZGAT_SCE); /* Z2-2 needs 10 MHz clock. */ outb(CLK_CONFIG(2, CLK_10MHZ), - devpriv->iobase1 + PCI224_ZCLK_SCE); + devpriv->iobase1 + PCI224_ZCLK_SCE); /* Load Z2-2 mode (2) and counter (div1). */ i8254_load(devpriv->iobase1 + PCI224_Z2_CT0, 0, - 2, div1, 2); + 2, div1, 2); /* Z2-0 is clocked from Z2-2's output. */ outb(CLK_CONFIG(0, CLK_OUTNM1), - devpriv->iobase1 + PCI224_ZCLK_SCE); + devpriv->iobase1 + PCI224_ZCLK_SCE); } /* Load Z2-0 mode (2) and counter (div2). */ i8254_load(devpriv->iobase1 + PCI224_Z2_CT0, 0, 0, div2, 2); @@ -1174,7 +1187,8 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* * 'cancel' function for AO subdevice. */ -static int pci224_ao_cancel(struct comedi_device *dev, struct comedi_subdevice *s) +static int pci224_ao_cancel(struct comedi_device *dev, + struct comedi_subdevice *s) { pci224_ao_stop(dev, s); return 0; @@ -1184,8 +1198,8 @@ static int pci224_ao_cancel(struct comedi_device *dev, struct comedi_subdevice * * 'munge' data for AO command. */ static void -pci224_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s, void *data, - unsigned int num_bytes, unsigned int chan_index) +pci224_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s, + void *data, unsigned int num_bytes, unsigned int chan_index) { struct comedi_async *async = s->async; short *array = data; @@ -1198,7 +1212,7 @@ pci224_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s, void *dat shift = 16 - thisboard->ao_bits; /* Channels will be all bipolar or all unipolar. */ if ((devpriv->hwrange[CR_RANGE(async->cmd.chanlist[0])] & - PCI224_DACCON_POLAR_MASK) == PCI224_DACCON_POLAR_UNI) { + PCI224_DACCON_POLAR_MASK) == PCI224_DACCON_POLAR_UNI) { /* Unipolar */ offset = 0; } else { @@ -1253,7 +1267,7 @@ static irqreturn_t pci224_interrupt(int irq, void *d) spin_lock_irqsave(&devpriv->ao_spinlock, flags); if (curenab != devpriv->intsce) { outb(devpriv->intsce, - devpriv->iobase1 + PCI224_INT_SCE); + devpriv->iobase1 + PCI224_INT_SCE); } devpriv->intr_running = 0; spin_unlock_irqrestore(&devpriv->ao_spinlock, flags); @@ -1267,7 +1281,7 @@ static irqreturn_t pci224_interrupt(int irq, void *d) */ static int pci224_find_pci(struct comedi_device *dev, int bus, int slot, - struct pci_dev **pci_dev_p) + struct pci_dev **pci_dev_p) { struct pci_dev *pci_dev = NULL; @@ -1275,13 +1289,13 @@ pci224_find_pci(struct comedi_device *dev, int bus, int slot, /* Look for matching PCI device. */ for (pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, PCI_ANY_ID, NULL); - pci_dev != NULL; - pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, PCI_ANY_ID, - pci_dev)) { + pci_dev != NULL; + pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, PCI_ANY_ID, + pci_dev)) { /* If bus/slot specified, check them. */ if (bus || slot) { if (bus != pci_dev->bus->number - || slot != PCI_SLOT(pci_dev->devfn)) + || slot != PCI_SLOT(pci_dev->devfn)) continue; } if (thisboard->model == any_model) { @@ -1310,11 +1324,11 @@ pci224_find_pci(struct comedi_device *dev, int bus, int slot, /* No match found. */ if (bus || slot) { printk(KERN_ERR "comedi%d: error! " - "no %s found at pci %02x:%02x!\n", - dev->minor, thisboard->name, bus, slot); + "no %s found at pci %02x:%02x!\n", + dev->minor, thisboard->name, bus, slot); } else { printk(KERN_ERR "comedi%d: error! no %s found!\n", - dev->minor, thisboard->name); + dev->minor, thisboard->name); } return -EIO; } @@ -1341,7 +1355,7 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) ret = alloc_private(dev, sizeof(struct pci224_private)); if (ret < 0) { printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); + dev->minor); return ret; } @@ -1353,8 +1367,8 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) ret = comedi_pci_enable(pci_dev, DRIVER_NAME); if (ret < 0) { printk(KERN_ERR - "comedi%d: error! cannot enable PCI device " - "and request regions!\n", dev->minor); + "comedi%d: error! cannot enable PCI device " + "and request regions!\n", dev->minor); return ret; } spin_lock_init(&devpriv->ao_spinlock); @@ -1365,21 +1379,21 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Allocate readback buffer for AO channels. */ devpriv->ao_readback = kmalloc(sizeof(devpriv->ao_readback[0]) * - thisboard->ao_chans, GFP_KERNEL); + thisboard->ao_chans, GFP_KERNEL); if (!devpriv->ao_readback) { return -ENOMEM; } /* Allocate buffer to hold values for AO channel scan. */ devpriv->ao_scan_vals = kmalloc(sizeof(devpriv->ao_scan_vals[0]) * - thisboard->ao_chans, GFP_KERNEL); + thisboard->ao_chans, GFP_KERNEL); if (!devpriv->ao_scan_vals) { return -ENOMEM; } /* Allocate buffer to hold AO channel scan order. */ devpriv->ao_scan_order = kmalloc(sizeof(devpriv->ao_scan_order[0]) * - thisboard->ao_chans, GFP_KERNEL); + thisboard->ao_chans, GFP_KERNEL); if (!devpriv->ao_scan_order) { return -ENOMEM; } @@ -1393,15 +1407,16 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) outw(0, dev->iobase + PCI224_DACCEN); outw(0, dev->iobase + PCI224_FIFOSIZ); devpriv->daccon = (PCI224_DACCON_TRIG_SW | PCI224_DACCON_POLAR_BI | - PCI224_DACCON_FIFOENAB | PCI224_DACCON_FIFOINTR_EMPTY); + PCI224_DACCON_FIFOENAB | + PCI224_DACCON_FIFOINTR_EMPTY); outw(devpriv->daccon | PCI224_DACCON_FIFORESET, - dev->iobase + PCI224_DACCON); + dev->iobase + PCI224_DACCON); /* Allocate subdevices. There is only one! */ ret = alloc_subdevices(dev, 1); if (ret < 0) { printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); + dev->minor); return ret; } @@ -1427,22 +1442,22 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) const struct comedi_lrange **range_table_list; s->range_table_list = range_table_list = - kmalloc(sizeof(struct comedi_lrange *) * s->n_chan, - GFP_KERNEL); + kmalloc(sizeof(struct comedi_lrange *) * s->n_chan, + GFP_KERNEL); if (!s->range_table_list) { return -ENOMEM; } for (n = 2; n < 3 + s->n_chan; n++) { if (it->options[n] < 0 || it->options[n] > 1) { printk(KERN_WARNING "comedi%d: %s: warning! " - "bad options[%u]=%d\n", - dev->minor, DRIVER_NAME, n, - it->options[n]); + "bad options[%u]=%d\n", + dev->minor, DRIVER_NAME, n, + it->options[n]); } } for (n = 0; n < s->n_chan; n++) { if (n < COMEDI_NDEVCONFOPTS - 3 && - it->options[3 + n] == 1) { + it->options[3 + n] == 1) { if (it->options[2] == 1) { range_table_list[n] = &range_pci234_ext; } else { @@ -1451,7 +1466,7 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) } else { if (it->options[2] == 1) { range_table_list[n] = - &range_pci234_ext2; + &range_pci234_ext2; } else { range_table_list[n] = &range_bipolar10; } @@ -1466,9 +1481,8 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) } else { if (it->options[2] != 0) { printk(KERN_WARNING "comedi%d: %s: warning! " - "bad options[2]=%d\n", - dev->minor, DRIVER_NAME, - it->options[2]); + "bad options[2]=%d\n", + dev->minor, DRIVER_NAME, it->options[2]); } s->range_table = &range_pci224_internal; devpriv->hwrange = hwrange_pci224_internal; @@ -1482,7 +1496,7 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) DRIVER_NAME, dev); if (ret < 0) { printk(KERN_ERR "comedi%d: error! " - "unable to allocate irq %u\n", dev->minor, irq); + "unable to allocate irq %u\n", dev->minor, irq); return ret; } else { dev->irq = irq; @@ -1545,7 +1559,7 @@ static int pci224_detach(struct comedi_device *dev) } if (dev->board_name) { printk(KERN_INFO "comedi%d: %s removed\n", - dev->minor, dev->board_name); + dev->minor, dev->board_name); } return 0; |