Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 337894
b: refs/heads/master
c: 61ca8ba
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Nov 15, 2012
1 parent 859fa81 commit b318378
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1f168dbdf731dea301a297e2409adc4a54ed6612
refs/heads/master: 61ca8bac45ea2fb263b3a7229e00f040df166501
44 changes: 44 additions & 0 deletions trunk/drivers/staging/comedi/drivers/comedi_fc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit b318378

Please sign in to comment.