linux/drivers/staging/comedi
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
..
drivers staging: comedi: s626: fix continuous acquisition 2013-03-25 11:35:38 -07:00
kcomedilib staging: comedi: use comedi_dev_from_minor() 2013-01-07 14:25:46 -08:00
Kconfig staging: comedi: das08: split out bus specific code 2013-02-03 17:33:08 -08:00
Makefile staging: comedi: conditionally build in PCMCIA driver support 2013-01-31 10:38:10 +01:00
TODO
comedi.h staging: comedi: deprecate loading firmware with comedi_config 2013-01-17 16:51:46 -08:00
comedi_buf.c staging: comedi: comedi_buf: remove noise in comedi_buf_read_free() 2013-01-17 16:56:01 -08:00
comedi_compat32.c staging: comedi: Makefile: conditionally compile multi-file core module 2013-01-07 14:51:11 -08:00
comedi_compat32.h staging: comedi: shrink comedi_compat32.h 2012-06-20 12:57:43 -07:00
comedi_fops.c more file_inode() open-coded instances 2013-02-27 16:59:05 -05:00
comedi_internal.h staging: comedi: remove 'comedi_autoconfig' module parameter 2013-02-05 11:22:08 -08:00
comedi_pci.c staging: comedi: conditionally build in PCI driver support 2013-01-31 10:38:10 +01:00
comedi_pcmcia.c staging: comedi: comedi_pcmcia: allow drivers to use a custom conf_check() 2013-02-05 18:16:19 -08:00
comedi_usb.c staging: comedi: comedi_usb: allow comedi usb drivers to pass a 'context' 2013-02-05 18:07:11 -08:00
comedidev.h staging: comedi: comedi_pcmcia: allow drivers to use a custom conf_check() 2013-02-05 18:16:19 -08:00
comedilib.h
drivers.c staging: Remove unnecessary OOM messages 2013-02-11 10:10:33 -08:00
proc.c staging: comedi: Makefile: conditionally compile multi-file core module 2013-01-07 14:51:11 -08:00
range.c staging: comedi: range: remove subdevice pointer math 2012-09-05 20:06:32 -07:00