staging: comedi: s626: clarify COMEDI_CB_EOA code
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 9 Sep 2014 23:16:02 +0000 (16:16 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 Sep 2014 21:35:22 +0000 (14:35 -0700)
The end-of-acquisition only applies when the cmd->stop_src == TRIG_COUNT.

Refactor the code in s626_handle_eos_interrupt() that detects the end-of-
acquisition to clarify this.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/s626.c

index aac661790dc4a5477b5c26053f56f35988ee15f4..8b4823ece682e1b0ee5a10cd640e071669ca562d 100644 (file)
@@ -1501,19 +1501,20 @@ static bool s626_handle_eos_interrupt(struct comedi_device *dev)
        /* end of scan occurs */
        async->events |= COMEDI_CB_EOS;
 
-       if (cmd->stop_src == TRIG_COUNT)
+       if (cmd->stop_src == TRIG_COUNT) {
                devpriv->ai_sample_count--;
-       if (devpriv->ai_sample_count <= 0) {
-               devpriv->ai_cmd_running = 0;
+               if (devpriv->ai_sample_count <= 0) {
+                       devpriv->ai_cmd_running = 0;
 
-               /* Stop RPS program */
-               s626_mc_disable(dev, S626_MC1_ERPS1, S626_P_MC1);
+                       /* Stop RPS program */
+                       s626_mc_disable(dev, S626_MC1_ERPS1, S626_P_MC1);
 
-               /* send end of acquisition */
-               async->events |= COMEDI_CB_EOA;
+                       /* send end of acquisition */
+                       async->events |= COMEDI_CB_EOA;
 
-               /* disable master interrupt */
-               finished = true;
+                       /* disable master interrupt */
+                       finished = true;
+               }
        }
 
        if (devpriv->ai_cmd_running && cmd->scan_begin_src == TRIG_EXT)
This page took 0.076004 seconds and 5 git commands to generate.