staging: comedi: ni_mio_common: tidy up the PFI subdevice init

For aesthetics, add some whitespace to the subdevice init and
tidy it up a bit.

Remove the need for the extra local variable.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
H Hartley Sweeten 2014-07-14 12:24:03 -07:00 committed by Greg Kroah-Hartman
parent 433c79f92e
commit 43f2c8b7de
1 changed files with 17 additions and 17 deletions

View File

@ -5490,9 +5490,9 @@ static int ni_E_init(struct comedi_device *dev,
const struct ni_board_struct *board = comedi_board(dev); const struct ni_board_struct *board = comedi_board(dev);
struct ni_private *devpriv = dev->private; struct ni_private *devpriv = dev->private;
struct comedi_subdevice *s; struct comedi_subdevice *s;
unsigned j;
enum ni_gpct_variant counter_variant; enum ni_gpct_variant counter_variant;
int ret; int ret;
int i;
if (board->n_aochan > MAX_N_AO_CHAN) { if (board->n_aochan > MAX_N_AO_CHAN) {
printk("bug! n_aochan > MAX_N_AO_CHAN\n"); printk("bug! n_aochan > MAX_N_AO_CHAN\n");
@ -5678,25 +5678,25 @@ static int ni_E_init(struct comedi_device *dev,
s->insn_read = ni_eeprom_insn_read; s->insn_read = ni_eeprom_insn_read;
} }
/* PFI */ /* Digital I/O (PFI) subdevice */
s = &dev->subdevices[NI_PFI_DIO_SUBDEV]; s = &dev->subdevices[NI_PFI_DIO_SUBDEV];
s->type = COMEDI_SUBD_DIO; s->type = COMEDI_SUBD_DIO;
s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL;
s->maxdata = 1;
if (devpriv->is_m_series) { if (devpriv->is_m_series) {
unsigned i; s->n_chan = 16;
s->n_chan = 16; s->insn_bits = ni_pfi_insn_bits;
ni_writew(dev, s->state, M_Offset_PFI_DO); ni_writew(dev, s->state, M_Offset_PFI_DO);
for (i = 0; i < NUM_PFI_OUTPUT_SELECT_REGS; ++i) { for (i = 0; i < NUM_PFI_OUTPUT_SELECT_REGS; ++i) {
ni_writew(dev, devpriv->pfi_output_select_reg[i], ni_writew(dev, devpriv->pfi_output_select_reg[i],
M_Offset_PFI_Output_Select(i + 1)); M_Offset_PFI_Output_Select(i + 1));
} }
} else { } else {
s->n_chan = 10; s->n_chan = 10;
} }
s->maxdata = 1; s->insn_config = ni_pfi_insn_config;
if (devpriv->is_m_series)
s->insn_bits = &ni_pfi_insn_bits;
s->insn_config = &ni_pfi_insn_config;
ni_set_bits(dev, IO_Bidirection_Pin_Register, ~0, 0); ni_set_bits(dev, IO_Bidirection_Pin_Register, ~0, 0);
/* cs5529 calibration adc */ /* cs5529 calibration adc */
@ -5748,8 +5748,8 @@ static int ni_E_init(struct comedi_device *dev,
return -ENOMEM; return -ENOMEM;
/* General purpose counters */ /* General purpose counters */
for (j = 0; j < NUM_GPCT; ++j) { for (i = 0; i < NUM_GPCT; ++i) {
s = &dev->subdevices[NI_GPCT_SUBDEV(j)]; s = &dev->subdevices[NI_GPCT_SUBDEV(i)];
s->type = COMEDI_SUBD_COUNTER; s->type = COMEDI_SUBD_COUNTER;
s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL; s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL;
s->n_chan = 3; s->n_chan = 3;
@ -5768,11 +5768,11 @@ static int ni_E_init(struct comedi_device *dev,
s->cancel = &ni_gpct_cancel; s->cancel = &ni_gpct_cancel;
s->async_dma_dir = DMA_BIDIRECTIONAL; s->async_dma_dir = DMA_BIDIRECTIONAL;
#endif #endif
s->private = &devpriv->counter_dev->counters[j]; s->private = &devpriv->counter_dev->counters[i];
devpriv->counter_dev->counters[j].chip_index = 0; devpriv->counter_dev->counters[i].chip_index = 0;
devpriv->counter_dev->counters[j].counter_index = j; devpriv->counter_dev->counters[i].counter_index = i;
ni_tio_init_counter(&devpriv->counter_dev->counters[j]); ni_tio_init_counter(&devpriv->counter_dev->counters[i]);
} }
/* Frequency output */ /* Frequency output */