Commit fad18543 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: amplc_dio200: support multiple read/write of counter

Change the `insn_read` and `insn_write` handlers of the '8254' counter
subdevices to support reading and writing multiple data values.
(Writing multiple values isn't very useful, but if that's what the user
wants....)
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c59515a8
...@@ -1270,13 +1270,15 @@ dio200_subdev_8254_read(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -1270,13 +1270,15 @@ dio200_subdev_8254_read(struct comedi_device *dev, struct comedi_subdevice *s,
{ {
struct dio200_subdev_8254 *subpriv = s->private; struct dio200_subdev_8254 *subpriv = s->private;
int chan = CR_CHAN(insn->chanspec); int chan = CR_CHAN(insn->chanspec);
unsigned int n;
unsigned long flags; unsigned long flags;
for (n = 0; n < insn->n; n++) {
spin_lock_irqsave(&subpriv->spinlock, flags); spin_lock_irqsave(&subpriv->spinlock, flags);
data[0] = dio200_subdev_8254_read_chan(dev, s, chan); data[n] = dio200_subdev_8254_read_chan(dev, s, chan);
spin_unlock_irqrestore(&subpriv->spinlock, flags); spin_unlock_irqrestore(&subpriv->spinlock, flags);
}
return 1; return insn->n;
} }
/* /*
...@@ -1288,13 +1290,15 @@ dio200_subdev_8254_write(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -1288,13 +1290,15 @@ dio200_subdev_8254_write(struct comedi_device *dev, struct comedi_subdevice *s,
{ {
struct dio200_subdev_8254 *subpriv = s->private; struct dio200_subdev_8254 *subpriv = s->private;
int chan = CR_CHAN(insn->chanspec); int chan = CR_CHAN(insn->chanspec);
unsigned int n;
unsigned long flags; unsigned long flags;
for (n = 0; n < insn->n; n++) {
spin_lock_irqsave(&subpriv->spinlock, flags); spin_lock_irqsave(&subpriv->spinlock, flags);
dio200_subdev_8254_write_chan(dev, s, chan, data[0]); dio200_subdev_8254_write_chan(dev, s, chan, data[n]);
spin_unlock_irqrestore(&subpriv->spinlock, flags); spin_unlock_irqrestore(&subpriv->spinlock, flags);
}
return 1; return insn->n;
} }
/* /*
......
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