diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2014-04-17 10:08:04 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-04-22 10:21:32 -0700 |
commit | c55881686302a5e7f19b82f0a163beec2cc314c3 (patch) | |
tree | 7f465f78c5e1e195cd26b4fa04cc83d9887502f6 | |
parent | 6a760394d7eb70a810bf472289473f915eb6da0d (diff) | |
download | linux-c55881686302a5e7f19b82f0a163beec2cc314c3.tar.bz2 |
staging: comedi: ni_labpc: clarify the cmd->start_arg validation
This driver supports cmd->start_src sources of TRIG_NOW and TRIG_EXT.
Refactor the (*do_cmdtest) to clarify the trivial validation of the
cmd->start_arg.
This also fixes a bug, the cmd->start_src has the trigger not the
cmd->start_arg.
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/ni_labpc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index f80ca3278314..fc9d31420956 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c @@ -649,8 +649,14 @@ static int labpc_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - if (cmd->start_arg == TRIG_NOW) + switch (cmd->start_src) { + case TRIG_NOW: err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + break; + case TRIG_EXT: + /* start_arg value is ignored */ + break; + } if (!cmd->chanlist_len) err |= -EINVAL; |