staging: comedi: quatech_daqp_cs: ai async command requires a pacer
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 5 Oct 2015 21:23:10 +0000 (14:23 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Oct 2015 04:16:05 +0000 (21:16 -0700)
The ai (*do_cmd) assumes that either the convert_src is TRIG_TIMER or
the scan_begin_src is TRIG_TIMER and always programs the pacer clock
with the appropriate trigger argument.

Add a Step 2b check to the (*do_cmdtest) to ensure that at least one
of the triggers is TRIG_TIMER.

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/quatech_daqp_cs.c

index 0ea02f0e1aa2767b95b3e0982a2994d38abbe370..b56d126869e3abfcc924bd46198d2cd16e87a67f 100644 (file)
@@ -394,6 +394,10 @@ static int daqp_ai_cmdtest(struct comedi_device *dev,
 
        /* Step 2b : and mutually compatible */
 
+       /* the async command requires a pacer */
+       if (cmd->scan_begin_src != TRIG_TIMER && cmd->convert_src != TRIG_TIMER)
+               err |= -EINVAL;
+
        if (err)
                return 2;