Use the new comedi_subdevice 'readback' member and the core provided (*insn_read) for the readback of the analog output subdevice channels. Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx> Cc: Ian Abbott <abbotti@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/comedi/drivers/das6402.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/das6402.c b/drivers/staging/comedi/drivers/das6402.c index d18eea6..7d9f26a 100644 --- a/drivers/staging/comedi/drivers/das6402.c +++ b/drivers/staging/comedi/drivers/das6402.c @@ -143,7 +143,6 @@ struct das6402_private { unsigned int divider2; unsigned int ao_range; - unsigned int ao_readback[2]; }; static void das6402_set_mode(struct comedi_device *dev, @@ -328,7 +327,7 @@ static int das6402_ao_insn_write(struct comedi_device *dev, for (i = 0; i < insn->n; i++) { val = data[i]; - devpriv->ao_readback[chan] = val; + s->readback[chan] = val; if (s->maxdata == 0x0fff) { /* @@ -358,9 +357,7 @@ static int das6402_ao_insn_read(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct das6402_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); - int i; /* * If XFER mode is enabled, reading any DAC register @@ -368,10 +365,7 @@ static int das6402_ao_insn_read(struct comedi_device *dev, */ inw(dev->iobase + DAS6402_AO_LSB_REG(chan)); - for (i = 0; i < insn->n; i++) - data[i] = devpriv->ao_readback[chan]; - - return insn->n; + return comedi_readback_insn_read(dev, s, insn, data); } static int das6402_di_insn_bits(struct comedi_device *dev, @@ -510,6 +504,10 @@ static int das6402_attach(struct comedi_device *dev, s->insn_write = das6402_ao_insn_write; s->insn_read = das6402_ao_insn_read; + ret = comedi_alloc_subdev_readback(s); + if (ret) + return ret; + /* Digital Input subdevice */ s = &dev->subdevices[2]; s->type = COMEDI_SUBD_DI; -- 2.0.3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel