aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/go7007/go7007-v4l2.c63
1 files changed, 21 insertions, 42 deletions
diff --git a/drivers/staging/go7007/go7007-v4l2.c b/drivers/staging/go7007/go7007-v4l2.c
index 0c32533e31fa..65f63d214985 100644
--- a/drivers/staging/go7007/go7007-v4l2.c
+++ b/drivers/staging/go7007/go7007-v4l2.c
@@ -593,8 +593,7 @@ static int mpeg_g_ctrl(struct v4l2_control *ctrl, struct go7007 *go)
593static int vidioc_querycap(struct file *file, void *priv, 593static int vidioc_querycap(struct file *file, void *priv,
594 struct v4l2_capability *cap) 594 struct v4l2_capability *cap)
595{ 595{
596 struct go7007_file *gofh = priv; 596 struct go7007 *go = ((struct go7007_file *) priv)->go;
597 struct go7007 *go = gofh->go;
598 597
599 strlcpy(cap->driver, "go7007", sizeof(cap->driver)); 598 strlcpy(cap->driver, "go7007", sizeof(cap->driver));
600 strlcpy(cap->card, go->name, sizeof(cap->card)); 599 strlcpy(cap->card, go->name, sizeof(cap->card));
@@ -641,8 +640,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
641static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, 640static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
642 struct v4l2_format *fmt) 641 struct v4l2_format *fmt)
643{ 642{
644 struct go7007_file *gofh = priv; 643 struct go7007 *go = ((struct go7007_file *) priv)->go;
645 struct go7007 *go = gofh->go;
646 644
647 fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 645 fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
648 fmt->fmt.pix.width = go->width; 646 fmt->fmt.pix.width = go->width;
@@ -660,8 +658,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
660static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, 658static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
661 struct v4l2_format *fmt) 659 struct v4l2_format *fmt)
662{ 660{
663 struct go7007_file *gofh = priv; 661 struct go7007 *go = ((struct go7007_file *) priv)->go;
664 struct go7007 *go = gofh->go;
665 662
666 return set_capture_size(go, fmt, 1); 663 return set_capture_size(go, fmt, 1);
667} 664}
@@ -669,8 +666,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
669static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, 666static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
670 struct v4l2_format *fmt) 667 struct v4l2_format *fmt)
671{ 668{
672 struct go7007_file *gofh = priv; 669 struct go7007 *go = ((struct go7007_file *) priv)->go;
673 struct go7007 *go = gofh->go;
674 670
675 if (go->streaming) 671 if (go->streaming)
676 return -EBUSY; 672 return -EBUSY;
@@ -976,8 +972,7 @@ static int vidioc_streamoff(struct file *file, void *priv,
976static int vidioc_queryctrl(struct file *file, void *priv, 972static int vidioc_queryctrl(struct file *file, void *priv,
977 struct v4l2_queryctrl *query) 973 struct v4l2_queryctrl *query)
978{ 974{
979 struct go7007_file *gofh = priv; 975 struct go7007 *go = ((struct go7007_file *) priv)->go;
980 struct go7007 *go = gofh->go;
981 976
982 if (!go->i2c_adapter_online) 977 if (!go->i2c_adapter_online)
983 return -EIO; 978 return -EIO;
@@ -990,8 +985,7 @@ static int vidioc_queryctrl(struct file *file, void *priv,
990static int vidioc_g_ctrl(struct file *file, void *priv, 985static int vidioc_g_ctrl(struct file *file, void *priv,
991 struct v4l2_control *ctrl) 986 struct v4l2_control *ctrl)
992{ 987{
993 struct go7007_file *gofh = priv; 988 struct go7007 *go = ((struct go7007_file *) priv)->go;
994 struct go7007 *go = gofh->go;
995 struct v4l2_queryctrl query; 989 struct v4l2_queryctrl query;
996 990
997 if (!go->i2c_adapter_online) 991 if (!go->i2c_adapter_online)
@@ -1010,8 +1004,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
1010static int vidioc_s_ctrl(struct file *file, void *priv, 1004static int vidioc_s_ctrl(struct file *file, void *priv,
1011 struct v4l2_control *ctrl) 1005 struct v4l2_control *ctrl)
1012{ 1006{
1013 struct go7007_file *gofh = priv; 1007 struct go7007 *go = ((struct go7007_file *) priv)->go;
1014 struct go7007 *go = gofh->go;
1015 struct v4l2_queryctrl query; 1008 struct v4l2_queryctrl query;
1016 1009
1017 if (!go->i2c_adapter_online) 1010 if (!go->i2c_adapter_online)
@@ -1030,8 +1023,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
1030static int vidioc_g_parm(struct file *filp, void *priv, 1023static int vidioc_g_parm(struct file *filp, void *priv,
1031 struct v4l2_streamparm *parm) 1024 struct v4l2_streamparm *parm)
1032{ 1025{
1033 struct go7007_file *gofh = priv; 1026 struct go7007 *go = ((struct go7007_file *) priv)->go;
1034 struct go7007 *go = gofh->go;
1035 struct v4l2_fract timeperframe = { 1027 struct v4l2_fract timeperframe = {
1036 .numerator = 1001 * go->fps_scale, 1028 .numerator = 1001 * go->fps_scale,
1037 .denominator = go->sensor_framerate, 1029 .denominator = go->sensor_framerate,
@@ -1049,8 +1041,7 @@ static int vidioc_g_parm(struct file *filp, void *priv,
1049static int vidioc_s_parm(struct file *filp, void *priv, 1041static int vidioc_s_parm(struct file *filp, void *priv,
1050 struct v4l2_streamparm *parm) 1042 struct v4l2_streamparm *parm)
1051{ 1043{
1052 struct go7007_file *gofh = priv; 1044 struct go7007 *go = ((struct go7007_file *) priv)->go;
1053 struct go7007 *go = gofh->go;
1054 unsigned int n, d; 1045 unsigned int n, d;
1055 1046
1056 if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1047 if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
@@ -1082,8 +1073,7 @@ static int vidioc_s_parm(struct file *filp, void *priv,
1082static int vidioc_enum_framesizes(struct file *filp, void *priv, 1073static int vidioc_enum_framesizes(struct file *filp, void *priv,
1083 struct v4l2_frmsizeenum *fsize) 1074 struct v4l2_frmsizeenum *fsize)
1084{ 1075{
1085 struct go7007_file *gofh = priv; 1076 struct go7007 *go = ((struct go7007_file *) priv)->go;
1086 struct go7007 *go = gofh->go;
1087 1077
1088 /* Return -EINVAL, if it is a TV board */ 1078 /* Return -EINVAL, if it is a TV board */
1089 if ((go->board_info->flags & GO7007_BOARD_HAS_TUNER) || 1079 if ((go->board_info->flags & GO7007_BOARD_HAS_TUNER) ||
@@ -1103,8 +1093,7 @@ static int vidioc_enum_framesizes(struct file *filp, void *priv,
1103static int vidioc_enum_frameintervals(struct file *filp, void *priv, 1093static int vidioc_enum_frameintervals(struct file *filp, void *priv,
1104 struct v4l2_frmivalenum *fival) 1094 struct v4l2_frmivalenum *fival)
1105{ 1095{
1106 struct go7007_file *gofh = priv; 1096 struct go7007 *go = ((struct go7007_file *) priv)->go;
1107 struct go7007 *go = gofh->go;
1108 1097
1109 /* Return -EINVAL, if it is a TV board */ 1098 /* Return -EINVAL, if it is a TV board */
1110 if ((go->board_info->flags & GO7007_BOARD_HAS_TUNER) || 1099 if ((go->board_info->flags & GO7007_BOARD_HAS_TUNER) ||
@@ -1123,8 +1112,7 @@ static int vidioc_enum_frameintervals(struct file *filp, void *priv,
1123 1112
1124static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *std) 1113static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *std)
1125{ 1114{
1126 struct go7007_file *gofh = priv; 1115 struct go7007 *go = ((struct go7007_file *) priv)->go;
1127 struct go7007 *go = gofh->go;
1128 1116
1129 if (go->streaming) 1117 if (go->streaming)
1130 return -EBUSY; 1118 return -EBUSY;
@@ -1188,8 +1176,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *std)
1188static int vidioc_enum_input(struct file *file, void *priv, 1176static int vidioc_enum_input(struct file *file, void *priv,
1189 struct v4l2_input *inp) 1177 struct v4l2_input *inp)
1190{ 1178{
1191 struct go7007_file *gofh = priv; 1179 struct go7007 *go = ((struct go7007_file *) priv)->go;
1192 struct go7007 *go = gofh->go;
1193 1180
1194 if (inp->index >= go->board_info->num_inputs) 1181 if (inp->index >= go->board_info->num_inputs)
1195 return -EINVAL; 1182 return -EINVAL;
@@ -1218,8 +1205,7 @@ static int vidioc_enum_input(struct file *file, void *priv,
1218 1205
1219static int vidioc_g_input(struct file *file, void *priv, unsigned int *input) 1206static int vidioc_g_input(struct file *file, void *priv, unsigned int *input)
1220{ 1207{
1221 struct go7007_file *gofh = priv; 1208 struct go7007 *go = ((struct go7007_file *) priv)->go;
1222 struct go7007 *go = gofh->go;
1223 1209
1224 *input = go->input; 1210 *input = go->input;
1225 1211
@@ -1228,8 +1214,7 @@ static int vidioc_g_input(struct file *file, void *priv, unsigned int *input)
1228 1214
1229static int vidioc_s_input(struct file *file, void *priv, unsigned int input) 1215static int vidioc_s_input(struct file *file, void *priv, unsigned int input)
1230{ 1216{
1231 struct go7007_file *gofh = priv; 1217 struct go7007 *go = ((struct go7007_file *) priv)->go;
1232 struct go7007 *go = gofh->go;
1233 1218
1234 if (input >= go->board_info->num_inputs) 1219 if (input >= go->board_info->num_inputs)
1235 return -EINVAL; 1220 return -EINVAL;
@@ -1250,8 +1235,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int input)
1250static int vidioc_g_tuner(struct file *file, void *priv, 1235static int vidioc_g_tuner(struct file *file, void *priv,
1251 struct v4l2_tuner *t) 1236 struct v4l2_tuner *t)
1252{ 1237{
1253 struct go7007_file *gofh = priv; 1238 struct go7007 *go = ((struct go7007_file *) priv)->go;
1254 struct go7007 *go = gofh->go;
1255 1239
1256 if (!(go->board_info->flags & GO7007_BOARD_HAS_TUNER)) 1240 if (!(go->board_info->flags & GO7007_BOARD_HAS_TUNER))
1257 return -EINVAL; 1241 return -EINVAL;
@@ -1269,8 +1253,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
1269static int vidioc_s_tuner(struct file *file, void *priv, 1253static int vidioc_s_tuner(struct file *file, void *priv,
1270 struct v4l2_tuner *t) 1254 struct v4l2_tuner *t)
1271{ 1255{
1272 struct go7007_file *gofh = priv; 1256 struct go7007 *go = ((struct go7007_file *) priv)->go;
1273 struct go7007 *go = gofh->go;
1274 1257
1275 if (!(go->board_info->flags & GO7007_BOARD_HAS_TUNER)) 1258 if (!(go->board_info->flags & GO7007_BOARD_HAS_TUNER))
1276 return -EINVAL; 1259 return -EINVAL;
@@ -1296,8 +1279,7 @@ static int vidioc_s_tuner(struct file *file, void *priv,
1296static int vidioc_g_frequency(struct file *file, void *priv, 1279static int vidioc_g_frequency(struct file *file, void *priv,
1297 struct v4l2_frequency *f) 1280 struct v4l2_frequency *f)
1298{ 1281{
1299 struct go7007_file *gofh = priv; 1282 struct go7007 *go = ((struct go7007_file *) priv)->go;
1300 struct go7007 *go = gofh->go;
1301 1283
1302 if (!(go->board_info->flags & GO7007_BOARD_HAS_TUNER)) 1284 if (!(go->board_info->flags & GO7007_BOARD_HAS_TUNER))
1303 return -EINVAL; 1285 return -EINVAL;
@@ -1312,8 +1294,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
1312static int vidioc_s_frequency(struct file *file, void *priv, 1294static int vidioc_s_frequency(struct file *file, void *priv,
1313 struct v4l2_frequency *f) 1295 struct v4l2_frequency *f)
1314{ 1296{
1315 struct go7007_file *gofh = priv; 1297 struct go7007 *go = ((struct go7007_file *) priv)->go;
1316 struct go7007 *go = gofh->go;
1317 1298
1318 if (!(go->board_info->flags & GO7007_BOARD_HAS_TUNER)) 1299 if (!(go->board_info->flags & GO7007_BOARD_HAS_TUNER))
1319 return -EINVAL; 1300 return -EINVAL;
@@ -1328,8 +1309,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
1328static int vidioc_cropcap(struct file *file, void *priv, 1309static int vidioc_cropcap(struct file *file, void *priv,
1329 struct v4l2_cropcap *cropcap) 1310 struct v4l2_cropcap *cropcap)
1330{ 1311{
1331 struct go7007_file *gofh = priv; 1312 struct go7007 *go = ((struct go7007_file *) priv)->go;
1332 struct go7007 *go = gofh->go;
1333 1313
1334 if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1314 if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1335 return -EINVAL; 1315 return -EINVAL;
@@ -1373,8 +1353,7 @@ static int vidioc_cropcap(struct file *file, void *priv,
1373 1353
1374static int vidioc_g_crop(struct file *file, void *priv, struct v4l2_crop *crop) 1354static int vidioc_g_crop(struct file *file, void *priv, struct v4l2_crop *crop)
1375{ 1355{
1376 struct go7007_file *gofh = priv; 1356 struct go7007 *go = ((struct go7007_file *) priv)->go;
1377 struct go7007 *go = gofh->go;
1378 1357
1379 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1358 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1380 return -EINVAL; 1359 return -EINVAL;