|
@@ -80,36 +80,6 @@ MODULE_LICENSE("GPL");
|
|
|
|
|
|
/* Helper functions for control handling */
|
|
|
|
|
|
-/* Check for correctness of the ctrl's value based on the data from
|
|
|
- struct v4l2_queryctrl and the available menu items. Note that
|
|
|
- menu_items may be NULL, in that case it is ignored. */
|
|
|
-int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
|
|
|
- const char * const *menu_items)
|
|
|
-{
|
|
|
- if (qctrl->flags & V4L2_CTRL_FLAG_DISABLED)
|
|
|
- return -EINVAL;
|
|
|
- if (qctrl->flags & V4L2_CTRL_FLAG_GRABBED)
|
|
|
- return -EBUSY;
|
|
|
- if (qctrl->type == V4L2_CTRL_TYPE_STRING)
|
|
|
- return 0;
|
|
|
- if (qctrl->type == V4L2_CTRL_TYPE_BUTTON ||
|
|
|
- qctrl->type == V4L2_CTRL_TYPE_INTEGER64 ||
|
|
|
- qctrl->type == V4L2_CTRL_TYPE_CTRL_CLASS)
|
|
|
- return 0;
|
|
|
- if (ctrl->value < qctrl->minimum || ctrl->value > qctrl->maximum)
|
|
|
- return -ERANGE;
|
|
|
- if (qctrl->type == V4L2_CTRL_TYPE_MENU && menu_items != NULL) {
|
|
|
- if (menu_items[ctrl->value] == NULL ||
|
|
|
- menu_items[ctrl->value][0] == '\0')
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- if (qctrl->type == V4L2_CTRL_TYPE_BITMASK &&
|
|
|
- (ctrl->value & ~qctrl->maximum))
|
|
|
- return -ERANGE;
|
|
|
- return 0;
|
|
|
-}
|
|
|
-EXPORT_SYMBOL(v4l2_ctrl_check);
|
|
|
-
|
|
|
/* Fill in a struct v4l2_queryctrl */
|
|
|
int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 _min, s32 _max, s32 _step, s32 _def)
|
|
|
{
|