Commit 7671896c authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: cb_pcidas: cleanup cb_pcidas_ao_nofifo_winsn()

Create local variables for the channel and range in order to
cleanup to mask/set of the ao_control_bits.

Remove the extra space in all the comments.

Return the number of data parameters used (insn->n) to indicate
success instead of the open coded '1'.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b78332da
...@@ -471,25 +471,25 @@ static int cb_pcidas_ao_nofifo_winsn(struct comedi_device *dev, ...@@ -471,25 +471,25 @@ static int cb_pcidas_ao_nofifo_winsn(struct comedi_device *dev,
unsigned int *data) unsigned int *data)
{ {
struct cb_pcidas_private *devpriv = dev->private; struct cb_pcidas_private *devpriv = dev->private;
int channel; unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int range = CR_RANGE(insn->chanspec);
unsigned long flags; unsigned long flags;
/* set channel and range */ /* set channel and range */
channel = CR_CHAN(insn->chanspec);
spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
devpriv->ao_control_bits &= devpriv->ao_control_bits &= (~DAC_MODE_UPDATE_BOTH &
~DAC_MODE_UPDATE_BOTH & ~DAC_RANGE_MASK(channel); ~DAC_RANGE_MASK(chan));
devpriv->ao_control_bits |= devpriv->ao_control_bits |= (DACEN | DAC_RANGE(chan, range));
DACEN | DAC_RANGE(channel, CR_RANGE(insn->chanspec));
outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR);
spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
/* remember value for readback */ /* remember value for readback */
devpriv->ao_value[channel] = data[0]; devpriv->ao_value[chan] = data[0];
/* send data */
outw(data[0], devpriv->ao_registers + DAC_DATA_REG(channel)); /* send data */
outw(data[0], devpriv->ao_registers + DAC_DATA_REG(chan));
return 1; return insn->n;
} }
/* analog output insn for pcidas-1602 series */ /* analog output insn for pcidas-1602 series */
......
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