This is a note to let you know that I've just added the patch titled

    staging: comedi: s626: fix continuous acquisition

to the 3.8-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     staging-comedi-s626-fix-continuous-acquisition.patch
and it can be found in the queue-3.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From e4317ce877a31dbb9d96375391c1c4ad2210d637 Mon Sep 17 00:00:00 2001
From: Ian Abbott <[email protected]>
Date: Fri, 22 Mar 2013 15:16:29 +0000
Subject: staging: comedi: s626: fix continuous acquisition

From: Ian Abbott <[email protected]>

commit e4317ce877a31dbb9d96375391c1c4ad2210d637 upstream.

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.

Signed-off-by: Ian Abbott <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/staging/comedi/drivers/s626.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -1482,7 +1482,7 @@ static int s626_ai_cmd(struct comedi_dev
        case TRIG_NONE:
                /*  continous acquisition */
                devpriv->ai_continous = 1;
-               devpriv->ai_sample_count = 0;
+               devpriv->ai_sample_count = 1;
                break;
        }
 


Patches currently in stable-queue which might be from [email protected] are

queue-3.8/staging-comedi-s626-fix-continuous-acquisition.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to