linux/drivers/staging
Ian Abbott e4317ce877 staging: comedi: s626: fix continuous acquisition
For the s626 driver, there is a bug in the handling of asynchronous
commands on the AI subdevice when the stop source is `TRIG_NONE`.  The
command should run continuously until cancelled, but the interrupt
handler stops the command running after the first scan.

The command set-up function `s626_ai_cmd()` contains this code:

	switch (cmd->stop_src) {
	case TRIG_COUNT:
		/*  data arrives as one packet */
		devpriv->ai_sample_count = cmd->stop_arg;
		devpriv->ai_continous = 0;
		break;
	case TRIG_NONE:
		/*  continous acquisition */
		devpriv->ai_continous = 1;
		devpriv->ai_sample_count = 0;
		break;
	}

The interrupt handler `s626_irq_handler()` contains this code:

		if (!(devpriv->ai_continous))
			devpriv->ai_sample_count--;
		if (devpriv->ai_sample_count <= 0) {
			devpriv->ai_cmd_running = 0;
			/* ... */
		}

So `devpriv->ai_sample_count` is only decremented for the `TRIG_COUNT`
case, but `devpriv->ai_cmd_running` is set to 0 (and the command
stopped) regardless.

Fix this in `s626_ai_cmd()` by setting `devpriv->ai_sample_count = 1`
for the `TRIG_NONE` case.  The interrupt handler will not decrement it
so it will remain greater than 0 and the check for stopping the
acquisition will fail.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25 11:35:38 -07:00
..
android hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
asus_oled
bcm Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
ccg fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
ced1401
comedi staging: comedi: s626: fix continuous acquisition 2013-03-25 11:35:38 -07:00
cptm1217
crystalhd
csr Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
cxt1e1
dgrp Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
echo
et131x Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
frontier
ft1000 Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
fwserial tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
gdm72xx
goldfish
iio Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
imx-drm staging: imx/drm: request irq only after adding the crtc 2013-03-11 09:31:48 -07:00
keucr
line6
media
net
nvec arm-soc: soc-specific updates 2013-02-21 15:27:22 -08:00
octeon Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
olpc_dcon
omap-thermal Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
ozwpan
panel
phison
quickstart
rtl8187se
rtl8192e
rtl8192u
rtl8712
rts5139
sb105x tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
sbe-2t3e3
sep
serqt_usb2
silicom
slicoss
sm7xxfb
speakup tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
ste_rmi4
tidspbridge tidspbridge: convert to idr_alloc() 2013-03-13 15:21:47 -07:00
usbip Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
vme Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
vt6655
vt6656 staging/vt6656: Fix too large integer constant warning on 32-bit 2013-03-11 09:53:46 -07:00
winbond
wlags49_h2 Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
wlags49_h25
wlan-ng Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
xgifb
zcache staging: zcache: fix typo "64_BIT" 2013-03-18 16:04:03 -07:00
zram
zsmalloc mm: rename page struct field helpers 2013-02-23 17:50:18 -08:00
Kconfig Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2013-02-25 16:46:44 -08:00
Makefile Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2013-02-25 16:46:44 -08:00
staging.c