On 14/08/15 22:29, H Hartley Sweeten wrote:
Move this check from the (*do_cmd) to the (*do_cmdtest).

Signed-off-by: H Hartley Sweeten <hswee...@visionengravers.com>
Cc: Ian Abbott <abbo...@mev.co.uk>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
  drivers/staging/comedi/drivers/usbduxfast.c | 12 +++++-------
  1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index 45060b9..407f091 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -389,6 +389,11 @@ static int usbduxfast_ai_cmdtest(struct comedi_device *dev,
        if (cmd->start_src == TRIG_EXT && cmd->stop_src == TRIG_EXT)
                err |= -EINVAL;

+       /* external start trigger is only valid for 1 or 16 channels */
+       if (cmd->start_src == TRIG_EXT &&
+           cmd->chanlist_len != 1 && cmd->chanlist_len != 16)
+               err |= -EINVAL;
+
        if (err)
                return 2;



I'd prefer this test to be done at step 3 of the command test since steps 1 and 2 just check the trigger sources on their own. It shouldn't make much difference in practice though, as the chanlist_len is generally expected to be set to the correct length (as it can affect the timing bounds) except when merely probing for the supported trigger sources.

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbo...@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to