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

staging: comedi: cb_pcidas: fix dac08_write_insn()

As pointed out by Ian Abbott, the comedi INSN_WRITE instructions
are meant to iterate over, and write, all the data[] passed from
the comedi core. Modify dac08_write_insn() to work as intended.

Since doc08_write_insn() now returns the proper response to the
core, make the dac08_write() helper return void.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reported-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b436356d
...@@ -659,7 +659,7 @@ static int caldac_read_insn(struct comedi_device *dev, ...@@ -659,7 +659,7 @@ static int caldac_read_insn(struct comedi_device *dev,
} }
/* 1602/16 pregain offset */ /* 1602/16 pregain offset */
static int dac08_write(struct comedi_device *dev, unsigned int value) static void dac08_write(struct comedi_device *dev, unsigned int value)
{ {
struct cb_pcidas_private *devpriv = dev->private; struct cb_pcidas_private *devpriv = dev->private;
unsigned long cal_reg; unsigned long cal_reg;
...@@ -680,14 +680,18 @@ static int dac08_write(struct comedi_device *dev, unsigned int value) ...@@ -680,14 +680,18 @@ static int dac08_write(struct comedi_device *dev, unsigned int value)
outw(value, cal_reg); outw(value, cal_reg);
udelay(1); udelay(1);
} }
return 1; /* insn->n */
} }
static int dac08_write_insn(struct comedi_device *dev, static int dac08_write_insn(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
return dac08_write(dev, data[0]); int i;
for (i = 0; i < insn->n; i++)
dac08_write(dev, data[i]);
return insn->n;
} }
static int dac08_read_insn(struct comedi_device *dev, static int dac08_read_insn(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