staging: comedi: adl_pci9118: fix the ai cmd->start_arg validation and use
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Thu, 17 Apr 2014 17:07:52 +0000 (10:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Apr 2014 17:21:30 +0000 (10:21 -0700)
commit01dc2a05f46280f825378be0bee8a2f13ca12c0a
tree407efbf50cb6f46488aa4f3739e38f9e251b5117
parent9b799edccbfb8c8973e8b55e8a0bfdc70c707f21
staging: comedi: adl_pci9118: fix the ai cmd->start_arg validation and use

This driver supports three cmd->start_src values, TRIG_NOW, TRIG_EXT, and
TRIG_INT. TRIG_NOW sources should always have an arg of 0 and arg for TRIG_EXT
sources is driver specific. This driver does not use the cmd->start_arg with
the TRIG_EXT source so a trivial value of 0 is good.

When the cmd->start_src is TRIG_INT the cmd->start_arg is actually the valid
trig_num that is passed to the async (*inttrig) callback. This driver allows
any value to be used and currently carries that value in the private data.

Refactor the (*do_cmdtest) so that the trivial validation of the cmd->start_arg
is clear.

Refactor the (*inttrig) so that the cmd->start_arg is used directly to check
the trig_num and remove the then unused 'ai_inttrig_start' member from the
private data.

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