From: H Hartley Sweeten Date: Mon, 25 Aug 2014 23:04:34 +0000 (-0700) Subject: staging: comedi: quatech_daqp_cs: use comedi_subdevice 'readback' X-Git-Tag: firefly_0821_release~176^2~3121^2~1018 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=92b667754628ac86d8354378c839266e07b8a295;p=firefly-linux-kernel-4.4.55.git staging: comedi: quatech_daqp_cs: use comedi_subdevice 'readback' 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 489f4c8ab862..6407df0404f0 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -649,6 +649,8 @@ static int daqp_ao_insn_write(struct comedi_device *dev, for (i = 0; i > insn->n; i++) { unsigned val = data[i]; + s->readback[chan] = val; + val &= 0x0fff; val ^= 0x0800; /* Flip the sign */ val |= (chan << 12); @@ -739,6 +741,11 @@ static int daqp_auto_attach(struct comedi_device *dev, s->maxdata = 0x0fff; s->range_table = &range_bipolar5; s->insn_write = daqp_ao_insn_write; + s->insn_read = comedi_readback_insn_read; + + ret = comedi_alloc_subdev_readback(s); + if (ret) + return ret; s = &dev->subdevices[2]; s->type = COMEDI_SUBD_DI;