diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2012-10-24 11:48:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-24 18:25:23 -0400 |
commit | fad18543cef4d6368b00fb318d0b31d1e2deabb6 (patch) | |
tree | 2227115095b3992ecf1420499c932f7a43a633f4 /drivers | |
parent | c59515a879d69fd8fc25c8d7eea6aa03ceb6983d (diff) |
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: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/comedi/drivers/amplc_dio200.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index d72a86b3e9ff..95c3f7824d81 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c | |||
@@ -1270,13 +1270,15 @@ dio200_subdev_8254_read(struct comedi_device *dev, struct comedi_subdevice *s, | |||
1270 | { | 1270 | { |
1271 | struct dio200_subdev_8254 *subpriv = s->private; | 1271 | struct dio200_subdev_8254 *subpriv = s->private; |
1272 | int chan = CR_CHAN(insn->chanspec); | 1272 | int chan = CR_CHAN(insn->chanspec); |
1273 | unsigned int n; | ||
1273 | unsigned long flags; | 1274 | unsigned long flags; |
1274 | 1275 | ||
1275 | spin_lock_irqsave(&subpriv->spinlock, flags); | 1276 | for (n = 0; n < insn->n; n++) { |
1276 | data[0] = dio200_subdev_8254_read_chan(dev, s, chan); | 1277 | spin_lock_irqsave(&subpriv->spinlock, flags); |
1277 | spin_unlock_irqrestore(&subpriv->spinlock, flags); | 1278 | data[n] = dio200_subdev_8254_read_chan(dev, s, chan); |
1278 | 1279 | spin_unlock_irqrestore(&subpriv->spinlock, flags); | |
1279 | return 1; | 1280 | } |
1281 | return insn->n; | ||
1280 | } | 1282 | } |
1281 | 1283 | ||
1282 | /* | 1284 | /* |
@@ -1288,13 +1290,15 @@ dio200_subdev_8254_write(struct comedi_device *dev, struct comedi_subdevice *s, | |||
1288 | { | 1290 | { |
1289 | struct dio200_subdev_8254 *subpriv = s->private; | 1291 | struct dio200_subdev_8254 *subpriv = s->private; |
1290 | int chan = CR_CHAN(insn->chanspec); | 1292 | int chan = CR_CHAN(insn->chanspec); |
1293 | unsigned int n; | ||
1291 | unsigned long flags; | 1294 | unsigned long flags; |
1292 | 1295 | ||
1293 | spin_lock_irqsave(&subpriv->spinlock, flags); | 1296 | for (n = 0; n < insn->n; n++) { |
1294 | dio200_subdev_8254_write_chan(dev, s, chan, data[0]); | 1297 | spin_lock_irqsave(&subpriv->spinlock, flags); |
1295 | spin_unlock_irqrestore(&subpriv->spinlock, flags); | 1298 | dio200_subdev_8254_write_chan(dev, s, chan, data[n]); |
1296 | 1299 | spin_unlock_irqrestore(&subpriv->spinlock, flags); | |
1297 | return 1; | 1300 | } |
1301 | return insn->n; | ||
1298 | } | 1302 | } |
1299 | 1303 | ||
1300 | /* | 1304 | /* |