The unmunged data should be saved for readback not the munged data. Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx> Cc: Ian Abbott <abbotti@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/comedi/drivers/rti800.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/rti800.c b/drivers/staging/comedi/drivers/rti800.c index 2b1db97..01ec65a 100644 --- a/drivers/staging/comedi/drivers/rti800.c +++ b/drivers/staging/comedi/drivers/rti800.c @@ -231,11 +231,13 @@ static int rti800_ao_insn_write(struct comedi_device *dev, unsigned int chan = CR_CHAN(insn->chanspec); int reg_lo = chan ? RTI800_DAC1LO : RTI800_DAC0LO; int reg_hi = chan ? RTI800_DAC1HI : RTI800_DAC0HI; - int val = devpriv->ao_readback[chan]; int i; for (i = 0; i < insn->n; i++) { - val = data[i]; + unsigned int val = data[i]; + + devpriv->ao_readback[chan] = val; + if (devpriv->dac_2comp[chan]) val ^= 0x800; @@ -243,8 +245,6 @@ static int rti800_ao_insn_write(struct comedi_device *dev, outb((val >> 8) & 0xff, dev->iobase + reg_hi); } - devpriv->ao_readback[chan] = val; - return insn->n; } -- 2.0.3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel