diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2015-08-24 10:13:59 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-09-12 18:24:24 -0700 |
commit | d636f87d861308a46ad18bb9b23c34ab32ea39de (patch) | |
tree | 37dd0843117242bcdf900af3153a914e2ffbcf93 | |
parent | 24b83783ceda1e7a0e871d9110cbf966387da4d5 (diff) |
staging: comedi: usbduxfast: TRIG_EXT only works for 1 or 16 channels
Move this check from the (*do_cmd) to the (*do_cmdtest).
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>
-rw-r--r-- | drivers/staging/comedi/drivers/usbduxfast.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 90422de80d82..118347671107 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -399,6 +399,11 @@ static int usbduxfast_ai_cmdtest(struct comedi_device *dev, if (!cmd->chanlist_len) 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; + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); @@ -519,13 +524,6 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev, up(&devpriv->sem); return -EINVAL; } - if ((cmd->start_src == TRIG_EXT) && (cmd->chanlist_len != 1) - && (cmd->chanlist_len != 16)) { - dev_err(dev->class_dev, - "TRIG_EXT only with 1 or 16 channels possible\n"); - up(&devpriv->sem); - return -EINVAL; - } switch (cmd->chanlist_len) { case 1: |