From c3c17d2eadce4e497a88783a625e07acb31f1dfb Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Aug 2014 16:04:30 -0700 Subject: [PATCH] staging: comedi: ii_pci20kc: save unmunged data for ao readback The unmunged data should be saved for readback not the munged data. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ii_pci20kc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/ii_pci20kc.c b/drivers/staging/comedi/drivers/ii_pci20kc.c index 687db433e131..10e8073dd919 100644 --- a/drivers/staging/comedi/drivers/ii_pci20kc.c +++ b/drivers/staging/comedi/drivers/ii_pci20kc.c @@ -165,12 +165,14 @@ static int ii20k_ao_insn_write(struct comedi_device *dev, struct ii20k_ao_private *ao_spriv = s->private; void __iomem *iobase = ii20k_module_iobase(dev, s); unsigned int chan = CR_CHAN(insn->chanspec); - unsigned int val = ao_spriv->last_data[chan]; + unsigned int val; int i; for (i = 0; i < insn->n; i++) { val = data[i]; + ao_spriv->last_data[chan] = val; + /* munge data */ val += ((s->maxdata + 1) >> 1); val &= s->maxdata; @@ -180,8 +182,6 @@ static int ii20k_ao_insn_write(struct comedi_device *dev, writeb(0x00, iobase + II20K_AO_STRB_REG(chan)); } - ao_spriv->last_data[chan] = val; - return insn->n; } -- 2.30.2