aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-04-08 11:59:50 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-07 15:31:41 -0400
commitcb74d482f81bf6a3ef3e29cb228c917e371773f2 (patch)
tree9bf1eca021b296407d13db32ff4b384f31a005b7
parent35f16741263fb50c82d5ade53ef9880a6b05f08a (diff)
[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>
-rw-r--r--drivers/media/video/uvc/uvc_ctrl.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c
index d20d0de707d1..0c27cc154eaf 100644
--- a/drivers/media/video/uvc/uvc_ctrl.c
+++ b/drivers/media/video/uvc/uvc_ctrl.c
@@ -899,6 +899,44 @@ static int uvc_ctrl_populate_cache(struct uvc_video_chain *chain,
899 return 0; 899 return 0;
900} 900}
901 901
902static int __uvc_ctrl_get(struct uvc_video_chain *chain,
903 struct uvc_control *ctrl, struct uvc_control_mapping *mapping,
904 s32 *value)
905{
906 struct uvc_menu_info *menu;
907 unsigned int i;
908 int ret;
909
910 if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0)
911 return -EINVAL;
912
913 if (!ctrl->loaded) {
914 ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, ctrl->entity->id,
915 chain->dev->intfnum, ctrl->info.selector,
916 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
917 ctrl->info.size);
918 if (ret < 0)
919 return ret;
920
921 ctrl->loaded = 1;
922 }
923
924 *value = mapping->get(mapping, UVC_GET_CUR,
925 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT));
926
927 if (mapping->v4l2_type == V4L2_CTRL_TYPE_MENU) {
928 menu = mapping->menu_info;
929 for (i = 0; i < mapping->menu_count; ++i, ++menu) {
930 if (menu->value == *value) {
931 *value = i;
932 break;
933 }
934 }
935 }
936
937 return 0;
938}
939
902static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, 940static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
903 struct uvc_control *ctrl, 941 struct uvc_control *ctrl,
904 struct uvc_control_mapping *mapping, 942 struct uvc_control_mapping *mapping,
@@ -1158,44 +1196,6 @@ done:
1158 return ret; 1196 return ret;
1159} 1197}
1160 1198
1161static int __uvc_ctrl_get(struct uvc_video_chain *chain,
1162 struct uvc_control *ctrl, struct uvc_control_mapping *mapping,
1163 s32 *value)
1164{
1165 struct uvc_menu_info *menu;
1166 unsigned int i;
1167 int ret;
1168
1169 if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0)
1170 return -EINVAL;
1171
1172 if (!ctrl->loaded) {
1173 ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, ctrl->entity->id,
1174 chain->dev->intfnum, ctrl->info.selector,
1175 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
1176 ctrl->info.size);
1177 if (ret < 0)
1178 return ret;
1179
1180 ctrl->loaded = 1;
1181 }
1182
1183 *value = mapping->get(mapping, UVC_GET_CUR,
1184 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT));
1185
1186 if (mapping->v4l2_type == V4L2_CTRL_TYPE_MENU) {
1187 menu = mapping->menu_info;
1188 for (i = 0; i < mapping->menu_count; ++i, ++menu) {
1189 if (menu->value == *value) {
1190 *value = i;
1191 break;
1192 }
1193 }
1194 }
1195
1196 return 0;
1197}
1198
1199int uvc_ctrl_get(struct uvc_video_chain *chain, 1199int uvc_ctrl_get(struct uvc_video_chain *chain,
1200 struct v4l2_ext_control *xctrl) 1200 struct v4l2_ext_control *xctrl)
1201{ 1201{