From: H Hartley Sweeten Date: Mon, 24 Aug 2015 17:13:59 +0000 (-0700) Subject: staging: comedi: usbduxfast: TRIG_EXT only works for 1 or 16 channels X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d636f87d861308a46ad18bb9b23c34ab32ea39de;p=linux-beck.git 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- 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: