Commit 767700c4 authored by Jason Wong's avatar Jason Wong Committed by Greg Kroah-Hartman

Staging: comedi: amplc_pci224: fixed multiple brace coding style issue

Fixed multiple coding style issue.
Signed-off-by: default avatarJason Wong <tsanghan@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 20617f22
...@@ -496,9 +496,9 @@ pci224_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -496,9 +496,9 @@ pci224_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s,
/* Writing a list of values to an AO channel is probably not /* Writing a list of values to an AO channel is probably not
* very useful, but that's how the interface is defined. */ * very useful, but that's how the interface is defined. */
for (i = 0; i < insn->n; i++) { for (i = 0; i < insn->n; i++)
pci224_ao_set_data(dev, chan, range, data[i]); pci224_ao_set_data(dev, chan, range, data[i]);
}
return i; return i;
} }
...@@ -519,9 +519,9 @@ pci224_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -519,9 +519,9 @@ pci224_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s,
chan = CR_CHAN(insn->chanspec); chan = CR_CHAN(insn->chanspec);
for (i = 0; i < insn->n; i++) { for (i = 0; i < insn->n; i++)
data[i] = devpriv->ao_readback[chan]; data[i] = devpriv->ao_readback[chan];
}
return i; return i;
} }
...@@ -544,9 +544,9 @@ static void pci224_ao_stop(struct comedi_device *dev, ...@@ -544,9 +544,9 @@ static void pci224_ao_stop(struct comedi_device *dev,
{ {
unsigned long flags; unsigned long flags;
if (!test_and_clear_bit(AO_CMD_STARTED, &devpriv->state)) { if (!test_and_clear_bit(AO_CMD_STARTED, &devpriv->state))
return; return;
}
spin_lock_irqsave(&devpriv->ao_spinlock, flags); spin_lock_irqsave(&devpriv->ao_spinlock, flags);
/* Kill the interrupts. */ /* Kill the interrupts. */
...@@ -597,11 +597,11 @@ static void pci224_ao_start(struct comedi_device *dev, ...@@ -597,11 +597,11 @@ static void pci224_ao_start(struct comedi_device *dev,
} else { } else {
/* Enable interrupts. */ /* Enable interrupts. */
spin_lock_irqsave(&devpriv->ao_spinlock, flags); spin_lock_irqsave(&devpriv->ao_spinlock, flags);
if (cmd->stop_src == TRIG_EXT) { if (cmd->stop_src == TRIG_EXT)
devpriv->intsce = PCI224_INTR_EXT | PCI224_INTR_DAC; devpriv->intsce = PCI224_INTR_EXT | PCI224_INTR_DAC;
} else { else
devpriv->intsce = PCI224_INTR_DAC; devpriv->intsce = PCI224_INTR_DAC;
}
outb(devpriv->intsce, devpriv->iobase1 + PCI224_INT_SCE); outb(devpriv->intsce, devpriv->iobase1 + PCI224_INT_SCE);
spin_unlock_irqrestore(&devpriv->ao_spinlock, flags); spin_unlock_irqrestore(&devpriv->ao_spinlock, flags);
} }
...@@ -630,9 +630,9 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, ...@@ -630,9 +630,9 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev,
num_scans = comedi_buf_read_n_available(s->async) / bytes_per_scan; num_scans = comedi_buf_read_n_available(s->async) / bytes_per_scan;
if (!devpriv->ao_stop_continuous) { if (!devpriv->ao_stop_continuous) {
/* Fixed number of scans. */ /* Fixed number of scans. */
if (num_scans > devpriv->ao_stop_count) { if (num_scans > devpriv->ao_stop_count)
num_scans = devpriv->ao_stop_count; num_scans = devpriv->ao_stop_count;
}
} }
/* Determine how much room is in the FIFO (in samples). */ /* Determine how much room is in the FIFO (in samples). */
...@@ -669,13 +669,13 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, ...@@ -669,13 +669,13 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev,
} }
} }
/* Determine how many new scans can be put in the FIFO. */ /* Determine how many new scans can be put in the FIFO. */
if (cmd->chanlist_len) { if (cmd->chanlist_len)
room /= cmd->chanlist_len; room /= cmd->chanlist_len;
}
/* Determine how many scans to process. */ /* Determine how many scans to process. */
if (num_scans > room) { if (num_scans > room)
num_scans = room; num_scans = room;
}
/* Process scans. */ /* Process scans. */
for (n = 0; n < num_scans; n++) { for (n = 0; n < num_scans; n++) {
cfc_read_array_from_buffer(s, &devpriv->ao_scan_vals[0], cfc_read_array_from_buffer(s, &devpriv->ao_scan_vals[0],
...@@ -718,19 +718,19 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, ...@@ -718,19 +718,19 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev,
trig = PCI224_DACCON_TRIG_Z2CT0; trig = PCI224_DACCON_TRIG_Z2CT0;
} else { } else {
/* cmd->scan_begin_src == TRIG_EXT */ /* cmd->scan_begin_src == TRIG_EXT */
if (cmd->scan_begin_arg & CR_INVERT) { if (cmd->scan_begin_arg & CR_INVERT)
trig = PCI224_DACCON_TRIG_EXTN; trig = PCI224_DACCON_TRIG_EXTN;
} else { else
trig = PCI224_DACCON_TRIG_EXTP; trig = PCI224_DACCON_TRIG_EXTP;
}
} }
devpriv->daccon = COMBINE(devpriv->daccon, trig, devpriv->daccon = COMBINE(devpriv->daccon, trig,
PCI224_DACCON_TRIG_MASK); PCI224_DACCON_TRIG_MASK);
outw(devpriv->daccon, dev->iobase + PCI224_DACCON); outw(devpriv->daccon, dev->iobase + PCI224_DACCON);
} }
if (s->async->events) { if (s->async->events)
comedi_event(dev, s); comedi_event(dev, s);
}
} }
/* /*
...@@ -855,9 +855,9 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -855,9 +855,9 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
err++; err++;
} }
tmp = cmd->chanlist_len * CONVERT_PERIOD; tmp = cmd->chanlist_len * CONVERT_PERIOD;
if (tmp < MIN_SCAN_PERIOD) { if (tmp < MIN_SCAN_PERIOD)
tmp = MIN_SCAN_PERIOD; tmp = MIN_SCAN_PERIOD;
}
if (cmd->scan_begin_arg < tmp) { if (cmd->scan_begin_arg < tmp) {
cmd->scan_begin_arg = tmp; cmd->scan_begin_arg = tmp;
err++; err++;
...@@ -966,9 +966,9 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -966,9 +966,9 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
devpriv->cached_div1 = div1; devpriv->cached_div1 = div1;
devpriv->cached_div2 = div2; devpriv->cached_div2 = div2;
} }
if (tmp != cmd->scan_begin_arg) { if (tmp != cmd->scan_begin_arg)
err++; err++;
}
} }
if (err) if (err)
...@@ -994,13 +994,13 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -994,13 +994,13 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
tmp = 0; tmp = 0;
for (n = 0; n < cmd->chanlist_len; n++) { for (n = 0; n < cmd->chanlist_len; n++) {
ch = CR_CHAN(cmd->chanlist[n]); ch = CR_CHAN(cmd->chanlist[n]);
if (tmp & (1U << ch)) { if (tmp & (1U << ch))
errors |= dupchan_err; errors |= dupchan_err;
}
tmp |= (1U << ch); tmp |= (1U << ch);
if (CR_RANGE(cmd->chanlist[n]) != range) { if (CR_RANGE(cmd->chanlist[n]) != range)
errors |= range_err; errors |= range_err;
}
} }
if (errors) { if (errors) {
if (errors & dupchan_err) { if (errors & dupchan_err) {
...@@ -1038,9 +1038,9 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1038,9 +1038,9 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
unsigned long flags; unsigned long flags;
/* Cannot handle null/empty chanlist. */ /* Cannot handle null/empty chanlist. */
if (cmd->chanlist == NULL || cmd->chanlist_len == 0) { if (cmd->chanlist == NULL || cmd->chanlist_len == 0)
return -EINVAL; return -EINVAL;
}
/* Determine which channels are enabled and their load order. */ /* Determine which channels are enabled and their load order. */
devpriv->ao_enab = 0; devpriv->ao_enab = 0;
...@@ -1050,9 +1050,9 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1050,9 +1050,9 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->ao_enab |= 1U << ch; devpriv->ao_enab |= 1U << ch;
rank = 0; rank = 0;
for (j = 0; j < cmd->chanlist_len; j++) { for (j = 0; j < cmd->chanlist_len; j++) {
if (CR_CHAN(cmd->chanlist[j]) < ch) { if (CR_CHAN(cmd->chanlist[j]) < ch)
rank++; rank++;
}
} }
devpriv->ao_scan_order[rank] = i; devpriv->ao_scan_order[rank] = i;
} }
...@@ -1221,9 +1221,9 @@ pci224_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -1221,9 +1221,9 @@ pci224_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s,
offset = 32768; offset = 32768;
} }
/* Munge the data. */ /* Munge the data. */
for (i = 0; i < length; i++) { for (i = 0; i < length; i++)
array[i] = (array[i] << shift) - offset; array[i] = (array[i] << shift) - offset;
}
} }
/* /*
...@@ -1254,15 +1254,15 @@ static irqreturn_t pci224_interrupt(int irq, void *d) ...@@ -1254,15 +1254,15 @@ static irqreturn_t pci224_interrupt(int irq, void *d)
cmd = &s->async->cmd; cmd = &s->async->cmd;
if (valid_intstat & PCI224_INTR_EXT) { if (valid_intstat & PCI224_INTR_EXT) {
devpriv->intsce &= ~PCI224_INTR_EXT; devpriv->intsce &= ~PCI224_INTR_EXT;
if (cmd->start_src == TRIG_EXT) { if (cmd->start_src == TRIG_EXT)
pci224_ao_start(dev, s); pci224_ao_start(dev, s);
} else if (cmd->stop_src == TRIG_EXT) { else if (cmd->stop_src == TRIG_EXT)
pci224_ao_stop(dev, s); pci224_ao_stop(dev, s);
}
} }
if (valid_intstat & PCI224_INTR_DAC) { if (valid_intstat & PCI224_INTR_DAC)
pci224_ao_handle_fifo(dev, s); pci224_ao_handle_fifo(dev, s);
}
} }
/* Reenable interrupt sources. */ /* Reenable interrupt sources. */
spin_lock_irqsave(&devpriv->ao_spinlock, flags); spin_lock_irqsave(&devpriv->ao_spinlock, flags);
...@@ -1381,23 +1381,23 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1381,23 +1381,23 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* Allocate readback buffer for AO channels. */ /* Allocate readback buffer for AO channels. */
devpriv->ao_readback = kmalloc(sizeof(devpriv->ao_readback[0]) * devpriv->ao_readback = kmalloc(sizeof(devpriv->ao_readback[0]) *
thisboard->ao_chans, GFP_KERNEL); thisboard->ao_chans, GFP_KERNEL);
if (!devpriv->ao_readback) { if (!devpriv->ao_readback)
return -ENOMEM; return -ENOMEM;
}
/* Allocate buffer to hold values for AO channel scan. */ /* Allocate buffer to hold values for AO channel scan. */
devpriv->ao_scan_vals = kmalloc(sizeof(devpriv->ao_scan_vals[0]) * 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) { if (!devpriv->ao_scan_vals)
return -ENOMEM; return -ENOMEM;
}
/* Allocate buffer to hold AO channel scan order. */ /* Allocate buffer to hold AO channel scan order. */
devpriv->ao_scan_order = kmalloc(sizeof(devpriv->ao_scan_order[0]) * 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) { if (!devpriv->ao_scan_order)
return -ENOMEM; return -ENOMEM;
}
/* Disable interrupt sources. */ /* Disable interrupt sources. */
devpriv->intsce = 0; devpriv->intsce = 0;
...@@ -1445,9 +1445,9 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1445,9 +1445,9 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it)
s->range_table_list = range_table_list = s->range_table_list = range_table_list =
kmalloc(sizeof(struct comedi_lrange *) * s->n_chan, kmalloc(sizeof(struct comedi_lrange *) * s->n_chan,
GFP_KERNEL); GFP_KERNEL);
if (!s->range_table_list) { if (!s->range_table_list)
return -ENOMEM; return -ENOMEM;
}
for (n = 2; n < 3 + s->n_chan; n++) { for (n = 2; n < 3 + s->n_chan; n++) {
if (it->options[n] < 0 || it->options[n] > 1) { if (it->options[n] < 0 || it->options[n] > 1) {
printk(KERN_WARNING "comedi%d: %s: warning! " printk(KERN_WARNING "comedi%d: %s: warning! "
...@@ -1459,11 +1459,11 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1459,11 +1459,11 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it)
for (n = 0; n < s->n_chan; n++) { for (n = 0; n < s->n_chan; n++) {
if (n < COMEDI_NDEVCONFOPTS - 3 && if (n < COMEDI_NDEVCONFOPTS - 3 &&
it->options[3 + n] == 1) { it->options[3 + n] == 1) {
if (it->options[2] == 1) { if (it->options[2] == 1)
range_table_list[n] = &range_pci234_ext; range_table_list[n] = &range_pci234_ext;
} else { else
range_table_list[n] = &range_bipolar5; range_table_list[n] = &range_bipolar5;
}
} else { } else {
if (it->options[2] == 1) { if (it->options[2] == 1) {
range_table_list[n] = range_table_list[n] =
...@@ -1506,11 +1506,11 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1506,11 +1506,11 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it)
printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name); printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name);
printk("(pci %s) ", pci_name(pci_dev)); printk("(pci %s) ", pci_name(pci_dev));
if (irq) { if (irq)
printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE")); printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE"));
} else { else
printk("(no irq) "); printk("(no irq) ");
}
printk("attached\n"); printk("attached\n");
...@@ -1529,9 +1529,9 @@ static int pci224_detach(struct comedi_device *dev) ...@@ -1529,9 +1529,9 @@ static int pci224_detach(struct comedi_device *dev)
{ {
printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor, DRIVER_NAME); printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor, DRIVER_NAME);
if (dev->irq) { if (dev->irq)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
}
if (dev->subdevices) { if (dev->subdevices) {
struct comedi_subdevice *s; struct comedi_subdevice *s;
...@@ -1544,9 +1544,9 @@ static int pci224_detach(struct comedi_device *dev) ...@@ -1544,9 +1544,9 @@ static int pci224_detach(struct comedi_device *dev)
kfree(devpriv->ao_scan_vals); kfree(devpriv->ao_scan_vals);
kfree(devpriv->ao_scan_order); kfree(devpriv->ao_scan_order);
if (devpriv->pci_dev) { if (devpriv->pci_dev) {
if (dev->iobase) { if (dev->iobase)
comedi_pci_disable(devpriv->pci_dev); comedi_pci_disable(devpriv->pci_dev);
}
pci_dev_put(devpriv->pci_dev); pci_dev_put(devpriv->pci_dev);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment