[media] uvcvideo: Move __uvc_ctrl_get() up
This avoids the need for doing a forward declaration of __uvc_ctrl_get (which is a static function) in later patches in this series. Note to reviewers this patch does not change a single line of code, it just moves the function up in uvc_ctrl.c a bit. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
35f1674126
commit
cb74d482f8
1 changed files with 38 additions and 38 deletions
|
@ -899,6 +899,44 @@ static int uvc_ctrl_populate_cache(struct uvc_video_chain *chain,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int __uvc_ctrl_get(struct uvc_video_chain *chain,
|
||||||
|
struct uvc_control *ctrl, struct uvc_control_mapping *mapping,
|
||||||
|
s32 *value)
|
||||||
|
{
|
||||||
|
struct uvc_menu_info *menu;
|
||||||
|
unsigned int i;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (!ctrl->loaded) {
|
||||||
|
ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, ctrl->entity->id,
|
||||||
|
chain->dev->intfnum, ctrl->info.selector,
|
||||||
|
uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
|
||||||
|
ctrl->info.size);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ctrl->loaded = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*value = mapping->get(mapping, UVC_GET_CUR,
|
||||||
|
uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT));
|
||||||
|
|
||||||
|
if (mapping->v4l2_type == V4L2_CTRL_TYPE_MENU) {
|
||||||
|
menu = mapping->menu_info;
|
||||||
|
for (i = 0; i < mapping->menu_count; ++i, ++menu) {
|
||||||
|
if (menu->value == *value) {
|
||||||
|
*value = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
|
static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
|
||||||
struct uvc_control *ctrl,
|
struct uvc_control *ctrl,
|
||||||
struct uvc_control_mapping *mapping,
|
struct uvc_control_mapping *mapping,
|
||||||
|
@ -1158,44 +1196,6 @@ done:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __uvc_ctrl_get(struct uvc_video_chain *chain,
|
|
||||||
struct uvc_control *ctrl, struct uvc_control_mapping *mapping,
|
|
||||||
s32 *value)
|
|
||||||
{
|
|
||||||
struct uvc_menu_info *menu;
|
|
||||||
unsigned int i;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (!ctrl->loaded) {
|
|
||||||
ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, ctrl->entity->id,
|
|
||||||
chain->dev->intfnum, ctrl->info.selector,
|
|
||||||
uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
|
|
||||||
ctrl->info.size);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
ctrl->loaded = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
*value = mapping->get(mapping, UVC_GET_CUR,
|
|
||||||
uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT));
|
|
||||||
|
|
||||||
if (mapping->v4l2_type == V4L2_CTRL_TYPE_MENU) {
|
|
||||||
menu = mapping->menu_info;
|
|
||||||
for (i = 0; i < mapping->menu_count; ++i, ++menu) {
|
|
||||||
if (menu->value == *value) {
|
|
||||||
*value = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int uvc_ctrl_get(struct uvc_video_chain *chain,
|
int uvc_ctrl_get(struct uvc_video_chain *chain,
|
||||||
struct v4l2_ext_control *xctrl)
|
struct v4l2_ext_control *xctrl)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue