Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] v4l2-common: move v4l2_ctrl_check to cx2341x

The v4l2_ctrl_check() helper function is now only used in cx2341x.
Move it there and make it static.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
4daee779 79fbc209

+30 -33
+29
drivers/media/common/cx2341x.c
··· 931 931 } 932 932 } 933 933 934 + /* Check for correctness of the ctrl's value based on the data from 935 + struct v4l2_queryctrl and the available menu items. Note that 936 + menu_items may be NULL, in that case it is ignored. */ 937 + static int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, 938 + const char * const *menu_items) 939 + { 940 + if (qctrl->flags & V4L2_CTRL_FLAG_DISABLED) 941 + return -EINVAL; 942 + if (qctrl->flags & V4L2_CTRL_FLAG_GRABBED) 943 + return -EBUSY; 944 + if (qctrl->type == V4L2_CTRL_TYPE_STRING) 945 + return 0; 946 + if (qctrl->type == V4L2_CTRL_TYPE_BUTTON || 947 + qctrl->type == V4L2_CTRL_TYPE_INTEGER64 || 948 + qctrl->type == V4L2_CTRL_TYPE_CTRL_CLASS) 949 + return 0; 950 + if (ctrl->value < qctrl->minimum || ctrl->value > qctrl->maximum) 951 + return -ERANGE; 952 + if (qctrl->type == V4L2_CTRL_TYPE_MENU && menu_items != NULL) { 953 + if (menu_items[ctrl->value] == NULL || 954 + menu_items[ctrl->value][0] == '\0') 955 + return -EINVAL; 956 + } 957 + if (qctrl->type == V4L2_CTRL_TYPE_BITMASK && 958 + (ctrl->value & ~qctrl->maximum)) 959 + return -ERANGE; 960 + return 0; 961 + } 962 + 934 963 int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy, 935 964 struct v4l2_ext_controls *ctrls, unsigned int cmd) 936 965 {
-30
drivers/media/v4l2-core/v4l2-common.c
··· 80 80 81 81 /* Helper functions for control handling */ 82 82 83 - /* Check for correctness of the ctrl's value based on the data from 84 - struct v4l2_queryctrl and the available menu items. Note that 85 - menu_items may be NULL, in that case it is ignored. */ 86 - int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, 87 - const char * const *menu_items) 88 - { 89 - if (qctrl->flags & V4L2_CTRL_FLAG_DISABLED) 90 - return -EINVAL; 91 - if (qctrl->flags & V4L2_CTRL_FLAG_GRABBED) 92 - return -EBUSY; 93 - if (qctrl->type == V4L2_CTRL_TYPE_STRING) 94 - return 0; 95 - if (qctrl->type == V4L2_CTRL_TYPE_BUTTON || 96 - qctrl->type == V4L2_CTRL_TYPE_INTEGER64 || 97 - qctrl->type == V4L2_CTRL_TYPE_CTRL_CLASS) 98 - return 0; 99 - if (ctrl->value < qctrl->minimum || ctrl->value > qctrl->maximum) 100 - return -ERANGE; 101 - if (qctrl->type == V4L2_CTRL_TYPE_MENU && menu_items != NULL) { 102 - if (menu_items[ctrl->value] == NULL || 103 - menu_items[ctrl->value][0] == '\0') 104 - return -EINVAL; 105 - } 106 - if (qctrl->type == V4L2_CTRL_TYPE_BITMASK && 107 - (ctrl->value & ~qctrl->maximum)) 108 - return -ERANGE; 109 - return 0; 110 - } 111 - EXPORT_SYMBOL(v4l2_ctrl_check); 112 - 113 83 /* Fill in a struct v4l2_queryctrl */ 114 84 int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 _min, s32 _max, s32 _step, s32 _def) 115 85 {
+1 -3
include/media/v4l2-common.h
··· 80 80 81 81 /* ------------------------------------------------------------------------- */ 82 82 83 - /* Control helper functions */ 83 + /* Control helper function */ 84 84 85 - int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, 86 - const char * const *menu_items); 87 85 int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def); 88 86 89 87 /* ------------------------------------------------------------------------- */