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

staging: comedi: pcl711: 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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dc49b499
...@@ -157,7 +157,6 @@ static const struct pcl711_board boardtypes[] = { ...@@ -157,7 +157,6 @@ static const struct pcl711_board boardtypes[] = {
struct pcl711_private { struct pcl711_private {
unsigned int ntrig; unsigned int ntrig;
unsigned int ao_readback[2];
unsigned int divisor1; unsigned int divisor1;
unsigned int divisor2; unsigned int divisor2;
}; };
...@@ -410,31 +409,15 @@ static int pcl711_ao_insn_write(struct comedi_device *dev, ...@@ -410,31 +409,15 @@ static int pcl711_ao_insn_write(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct pcl711_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec); unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int val = devpriv->ao_readback[chan]; unsigned int val = s->readback[chan];
int i; int i;
for (i = 0; i < insn->n; i++) { for (i = 0; i < insn->n; i++) {
val = data[i]; val = data[i];
pcl711_ao_write(dev, chan, val); pcl711_ao_write(dev, chan, val);
} }
devpriv->ao_readback[chan] = val; s->readback[chan] = val;
return insn->n;
}
static int pcl711_ao_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
struct pcl711_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec);
int i;
for (i = 0; i < insn->n; i++)
data[i] = devpriv->ao_readback[chan];
return insn->n; return insn->n;
} }
...@@ -527,7 +510,11 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -527,7 +510,11 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it)
s->maxdata = 0xfff; s->maxdata = 0xfff;
s->range_table = &range_bipolar5; s->range_table = &range_bipolar5;
s->insn_write = pcl711_ao_insn_write; s->insn_write = pcl711_ao_insn_write;
s->insn_read = pcl711_ao_insn_read; s->insn_read = comedi_readback_insn_read;
ret = comedi_alloc_subdev_readback(s);
if (ret)
return ret;
/* Digital Input subdevice */ /* Digital Input subdevice */
s = &dev->subdevices[2]; s = &dev->subdevices[2];
......
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