From 4c858074702ba80c9c1650daf4f07dc70427ea48 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 11 Sep 2012 10:47:08 -0700 Subject: [PATCH] --- yaml --- r: 325150 b: refs/heads/master c: 43b9778eeb789fbfad3ce66da3bbb3440440fbb8 h: refs/heads/master v: v3 --- [refs] | 2 +- .../staging/comedi/drivers/comedi_fc.h | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index f4b73b10f3cd..22e5140292a2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 13b2663c95f6f30f835ef92ef51c9aff0b3f09d6 +refs/heads/master: 43b9778eeb789fbfad3ce66da3bbb3440440fbb8 diff --git a/trunk/drivers/staging/comedi/drivers/comedi_fc.h b/trunk/drivers/staging/comedi/drivers/comedi_fc.h index 4b2cfd327995..1f0839171887 100644 --- a/trunk/drivers/staging/comedi/drivers/comedi_fc.h +++ b/trunk/drivers/staging/comedi/drivers/comedi_fc.h @@ -73,4 +73,24 @@ static inline unsigned int cfc_bytes_per_scan(struct comedi_subdevice *subd) return num_samples * bytes_per_sample(subd); } +/** + * cfc_check_trigger_src() - trivially validate a comedi_cmd trigger source + * @src: pointer to the trigger source to validate + * @flags: bitmask of valid TRIG_* for the trigger + * + * This is used in "step 1" of the do_cmdtest functions of comedi drivers + * to vaildate the comedi_cmd triggers. The mask of the @src against the + * @flags allows the userspace comedilib to pass all the comedi_cmd + * triggers as TRIG_ANY and get back a bitmask of the valid trigger sources. + */ +static inline int cfc_check_trigger_src(unsigned int *src, unsigned int flags) +{ + unsigned int orig_src = *src; + + *src = orig_src & flags; + if (*src == TRIG_INVALID || *src != orig_src) + return -EINVAL; + return 0; +} + #endif /* _COMEDI_FC_H */