[media] v4l2-common: move v4l2_ctrl_check to cx2341x
authorHans Verkuil <hans.verkuil@cisco.com>
Sun, 23 Nov 2014 12:39:55 +0000 (09:39 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 25 Nov 2014 10:25:36 +0000 (08:25 -0200)
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>
drivers/media/common/cx2341x.c
drivers/media/v4l2-core/v4l2-common.c
include/media/v4l2-common.h

index be763150b8aad014692871091e5cf702e333d3df..c07b9db51b05293d3ac039733286e5f36924ce0f 100644 (file)
@@ -931,6 +931,35 @@ static void cx2341x_calc_audio_properties(struct cx2341x_mpeg_params *params)
        }
 }
 
+/* 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. */
+static 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;
+}
+
 int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy,
                  struct v4l2_ext_controls *ctrls, unsigned int cmd)
 {
index 8493209326577c454f004572e41240ab8a66b758..5b808500e7e79166c4c2868a8c37d737209eb263 100644 (file)
@@ -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)
 {
index c69d91d32e59b9f99735f6691fcf631a96ae33e4..1cc0c5ba16b319fc36c60e454d71db005181df16 100644 (file)
 
 /* ------------------------------------------------------------------------- */
 
-/* Control helper functions */
+/* Control helper function */
 
-int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
-               const char * const *menu_items);
 int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def);
 
 /* ------------------------------------------------------------------------- */