From: H Hartley Sweeten Date: Tue, 11 Sep 2012 17:47:08 +0000 (-0700) Subject: staging: comedi: comedi_fc: introduce cfc_check_trigger_src X-Git-Tag: omap-for-v3.7-rc1/fixes-cpufreq-signed~75^2~362 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43b9778eeb789fbfad3ce66da3bbb3440440fbb8;p=pandora-kernel.git 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: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed