diff --git a/[refs] b/[refs] index 74feee6f4094..044c159dbcca 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1f168dbdf731dea301a297e2409adc4a54ed6612 +refs/heads/master: 61ca8bac45ea2fb263b3a7229e00f040df166501 diff --git a/trunk/drivers/staging/comedi/drivers/comedi_fc.h b/trunk/drivers/staging/comedi/drivers/comedi_fc.h index 94481c637a0a..31afab79f39a 100644 --- a/trunk/drivers/staging/comedi/drivers/comedi_fc.h +++ b/trunk/drivers/staging/comedi/drivers/comedi_fc.h @@ -105,4 +105,48 @@ static inline int cfc_check_trigger_is_unique(unsigned int src) return 0; } +/** + * cfc_check_trigger_arg_is() - trivially validate a trigger argument + * @arg: pointer to the trigger arg to validate + * @val: the value the argument should be + */ +static inline int cfc_check_trigger_arg_is(unsigned int *arg, unsigned int val) +{ + if (*arg != val) { + *arg = val; + return -EINVAL; + } + return 0; +} + +/** + * cfc_check_trigger_arg_min() - trivially validate a trigger argument + * @arg: pointer to the trigger arg to validate + * @val: the minimum value the argument should be + */ +static inline int cfc_check_trigger_arg_min(unsigned int *arg, + unsigned int val) +{ + if (*arg < val) { + *arg = val; + return -EINVAL; + } + return 0; +} + +/** + * cfc_check_trigger_arg_max() - trivially validate a trigger argument + * @arg: pointer to the trigger arg to validate + * @val: the maximum value the argument should be + */ +static inline int cfc_check_trigger_arg_max(unsigned int *arg, + unsigned int val) +{ + if (*arg > val) { + *arg = val; + return -EINVAL; + } + return 0; +} + #endif /* _COMEDI_FC_H */