Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 43b9778e authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

staging: comedi: comedi_fc: introduce cfc_check_trigger_src



All of the comedi drivers that support the 'cmd' callback also
require a 'do_cmdtest' callback. The do_cmdtest validates the
comedi_cmd before it is executed.

"Step 1" of each do_cmdtest does a trivial validation of the
trigger sources by doing something like this for each trigger:

	int err = 0;
	unsigned int tmp;

	tmp = cmd->start_src;
	src &= TRIG_NOW;
	if (!src || tmp != src)
		err++;
	/* Test the remaining triggers similarly */

	if (err)
		return 1;

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

	err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW);
	/* Test the remaining triggers similarly */

	if (err)
		return 1;

Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 13b2663c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment