Commit 3ecbbb56 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: fl512: tidy up fl512_ao_insn_write()

Tidy up this function. Only save the last value written for readback.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 96653ed6
......@@ -76,20 +76,21 @@ static int fl512_ao_insn_write(struct comedi_device *dev,
unsigned int *data)
{
struct fl512_private *devpriv = dev->private;
int n;
int chan = CR_CHAN(insn->chanspec); /* get chan to write */
for (n = 0; n < insn->n; n++) { /* write n data set */
/* write low byte */
outb(data[n] & 0x0ff, dev->iobase + FL512_AO_DATA_REG(chan));
/* write high byte */
outb((data[n] & 0xf00) >> 8,
dev->iobase + FL512_AO_DATA_REG(chan));
inb(dev->iobase + FL512_AO_TRIG_REG(chan));
unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int val = devpriv->ao_readback[chan];
int i;
for (i = 0; i < insn->n; i++) {
val = data[i];
devpriv->ao_readback[chan] = data[n];
/* write LSB, MSB then trigger conversion */
outb(val & 0x0ff, dev->iobase + FL512_AO_DATA_REG(chan));
outb((val >> 8) & 0xf, dev->iobase + FL512_AO_DATA_REG(chan));
inb(dev->iobase + FL512_AO_TRIG_REG(chan));
}
return n;
devpriv->ao_readback[chan] = val;
return insn->n;
}
static int fl512_ao_insn_read(struct comedi_device *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