staging: comedi: comedi_fc: introduce cfc_check_trigger_is_unique
authorH Hartley Sweeten <hartleys@visionengravers.com>
Tue, 11 Sep 2012 17:48:10 +0000 (10:48 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Sep 2012 19:11:04 +0000 (12:11 -0700)
"Step 2" of each do_cmdtest checks that the trigger sources are
unique by doing something like this for each trigger:

if (cmd->start_src != TRIG_TIMER &&
    cmd->start_src != TRIG_FOLLOW &&
    cmd->start_src != TRIG_EXT)
err++;
/* Test the remaining triggers similarly */

if (err)
return 2;

Introduce a helper function in comedi_fc to handle this boilerplate.
The drivers can then just do:

err |= cfc_check_trigger_is_unique(cmd->start_src);
/* Test the remaining triggers similarly */

if (err)
return 2;

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

No differences found