diff options
Diffstat (limited to 'drivers/media/video/meye.c')
-rw-r--r-- | drivers/media/video/meye.c | 45 |
1 files changed, 3 insertions, 42 deletions
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c index b76e33d5c867..2ad11f0999c6 100644 --- a/drivers/media/video/meye.c +++ b/drivers/media/video/meye.c | |||
@@ -1017,7 +1017,6 @@ static int meyeioc_stilljcapt(int *len) | |||
1017 | static int vidioc_querycap(struct file *file, void *fh, | 1017 | static int vidioc_querycap(struct file *file, void *fh, |
1018 | struct v4l2_capability *cap) | 1018 | struct v4l2_capability *cap) |
1019 | { | 1019 | { |
1020 | memset(cap, 0, sizeof(*cap)); | ||
1021 | strcpy(cap->driver, "meye"); | 1020 | strcpy(cap->driver, "meye"); |
1022 | strcpy(cap->card, "meye"); | 1021 | strcpy(cap->card, "meye"); |
1023 | sprintf(cap->bus_info, "PCI:%s", pci_name(meye.mchip_dev)); | 1022 | sprintf(cap->bus_info, "PCI:%s", pci_name(meye.mchip_dev)); |
@@ -1036,8 +1035,6 @@ static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i) | |||
1036 | if (i->index != 0) | 1035 | if (i->index != 0) |
1037 | return -EINVAL; | 1036 | return -EINVAL; |
1038 | 1037 | ||
1039 | memset(i, 0, sizeof(*i)); | ||
1040 | i->index = 0; | ||
1041 | strcpy(i->name, "Camera"); | 1038 | strcpy(i->name, "Camera"); |
1042 | i->type = V4L2_INPUT_TYPE_CAMERA; | 1039 | i->type = V4L2_INPUT_TYPE_CAMERA; |
1043 | 1040 | ||
@@ -1259,22 +1256,13 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *fh, | |||
1259 | if (f->index > 1) | 1256 | if (f->index > 1) |
1260 | return -EINVAL; | 1257 | return -EINVAL; |
1261 | 1258 | ||
1262 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
1263 | return -EINVAL; | ||
1264 | |||
1265 | if (f->index == 0) { | 1259 | if (f->index == 0) { |
1266 | /* standard YUV 422 capture */ | 1260 | /* standard YUV 422 capture */ |
1267 | memset(f, 0, sizeof(*f)); | ||
1268 | f->index = 0; | ||
1269 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1270 | f->flags = 0; | 1261 | f->flags = 0; |
1271 | strcpy(f->description, "YUV422"); | 1262 | strcpy(f->description, "YUV422"); |
1272 | f->pixelformat = V4L2_PIX_FMT_YUYV; | 1263 | f->pixelformat = V4L2_PIX_FMT_YUYV; |
1273 | } else { | 1264 | } else { |
1274 | /* compressed MJPEG capture */ | 1265 | /* compressed MJPEG capture */ |
1275 | memset(f, 0, sizeof(*f)); | ||
1276 | f->index = 1; | ||
1277 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1278 | f->flags = V4L2_FMT_FLAG_COMPRESSED; | 1266 | f->flags = V4L2_FMT_FLAG_COMPRESSED; |
1279 | strcpy(f->description, "MJPEG"); | 1267 | strcpy(f->description, "MJPEG"); |
1280 | f->pixelformat = V4L2_PIX_FMT_MJPEG; | 1268 | f->pixelformat = V4L2_PIX_FMT_MJPEG; |
@@ -1286,9 +1274,6 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *fh, | |||
1286 | static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, | 1274 | static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, |
1287 | struct v4l2_format *f) | 1275 | struct v4l2_format *f) |
1288 | { | 1276 | { |
1289 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
1290 | return -EINVAL; | ||
1291 | |||
1292 | if (f->fmt.pix.pixelformat != V4L2_PIX_FMT_YUYV && | 1277 | if (f->fmt.pix.pixelformat != V4L2_PIX_FMT_YUYV && |
1293 | f->fmt.pix.pixelformat != V4L2_PIX_FMT_MJPEG) | 1278 | f->fmt.pix.pixelformat != V4L2_PIX_FMT_MJPEG) |
1294 | return -EINVAL; | 1279 | return -EINVAL; |
@@ -1319,12 +1304,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, | |||
1319 | static int vidioc_g_fmt_vid_cap(struct file *file, void *fh, | 1304 | static int vidioc_g_fmt_vid_cap(struct file *file, void *fh, |
1320 | struct v4l2_format *f) | 1305 | struct v4l2_format *f) |
1321 | { | 1306 | { |
1322 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
1323 | return -EINVAL; | ||
1324 | |||
1325 | memset(&f->fmt.pix, 0, sizeof(struct v4l2_pix_format)); | ||
1326 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1327 | |||
1328 | switch (meye.mchip_mode) { | 1307 | switch (meye.mchip_mode) { |
1329 | case MCHIP_HIC_MODE_CONT_OUT: | 1308 | case MCHIP_HIC_MODE_CONT_OUT: |
1330 | default: | 1309 | default: |
@@ -1341,8 +1320,6 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *fh, | |||
1341 | f->fmt.pix.bytesperline = f->fmt.pix.width * 2; | 1320 | f->fmt.pix.bytesperline = f->fmt.pix.width * 2; |
1342 | f->fmt.pix.sizeimage = f->fmt.pix.height * | 1321 | f->fmt.pix.sizeimage = f->fmt.pix.height * |
1343 | f->fmt.pix.bytesperline; | 1322 | f->fmt.pix.bytesperline; |
1344 | f->fmt.pix.colorspace = 0; | ||
1345 | f->fmt.pix.priv = 0; | ||
1346 | 1323 | ||
1347 | return 0; | 1324 | return 0; |
1348 | } | 1325 | } |
@@ -1350,9 +1327,6 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *fh, | |||
1350 | static int vidioc_s_fmt_vid_cap(struct file *file, void *fh, | 1327 | static int vidioc_s_fmt_vid_cap(struct file *file, void *fh, |
1351 | struct v4l2_format *f) | 1328 | struct v4l2_format *f) |
1352 | { | 1329 | { |
1353 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
1354 | return -EINVAL; | ||
1355 | |||
1356 | if (f->fmt.pix.pixelformat != V4L2_PIX_FMT_YUYV && | 1330 | if (f->fmt.pix.pixelformat != V4L2_PIX_FMT_YUYV && |
1357 | f->fmt.pix.pixelformat != V4L2_PIX_FMT_MJPEG) | 1331 | f->fmt.pix.pixelformat != V4L2_PIX_FMT_MJPEG) |
1358 | return -EINVAL; | 1332 | return -EINVAL; |
@@ -1398,9 +1372,6 @@ static int vidioc_reqbufs(struct file *file, void *fh, | |||
1398 | { | 1372 | { |
1399 | int i; | 1373 | int i; |
1400 | 1374 | ||
1401 | if (req->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
1402 | return -EINVAL; | ||
1403 | |||
1404 | if (req->memory != V4L2_MEMORY_MMAP) | 1375 | if (req->memory != V4L2_MEMORY_MMAP) |
1405 | return -EINVAL; | 1376 | return -EINVAL; |
1406 | 1377 | ||
@@ -1441,15 +1412,11 @@ static int vidioc_reqbufs(struct file *file, void *fh, | |||
1441 | 1412 | ||
1442 | static int vidioc_querybuf(struct file *file, void *fh, struct v4l2_buffer *buf) | 1413 | static int vidioc_querybuf(struct file *file, void *fh, struct v4l2_buffer *buf) |
1443 | { | 1414 | { |
1444 | int index = buf->index; | 1415 | unsigned int index = buf->index; |
1445 | 1416 | ||
1446 | if (index < 0 || index >= gbuffers) | 1417 | if (index >= gbuffers) |
1447 | return -EINVAL; | 1418 | return -EINVAL; |
1448 | 1419 | ||
1449 | memset(buf, 0, sizeof(*buf)); | ||
1450 | |||
1451 | buf->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1452 | buf->index = index; | ||
1453 | buf->bytesused = meye.grab_buffer[index].size; | 1420 | buf->bytesused = meye.grab_buffer[index].size; |
1454 | buf->flags = V4L2_BUF_FLAG_MAPPED; | 1421 | buf->flags = V4L2_BUF_FLAG_MAPPED; |
1455 | 1422 | ||
@@ -1471,13 +1438,10 @@ static int vidioc_querybuf(struct file *file, void *fh, struct v4l2_buffer *buf) | |||
1471 | 1438 | ||
1472 | static int vidioc_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) | 1439 | static int vidioc_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) |
1473 | { | 1440 | { |
1474 | if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
1475 | return -EINVAL; | ||
1476 | |||
1477 | if (buf->memory != V4L2_MEMORY_MMAP) | 1441 | if (buf->memory != V4L2_MEMORY_MMAP) |
1478 | return -EINVAL; | 1442 | return -EINVAL; |
1479 | 1443 | ||
1480 | if (buf->index < 0 || buf->index >= gbuffers) | 1444 | if (buf->index >= gbuffers) |
1481 | return -EINVAL; | 1445 | return -EINVAL; |
1482 | 1446 | ||
1483 | if (meye.grab_buffer[buf->index].state != MEYE_BUF_UNUSED) | 1447 | if (meye.grab_buffer[buf->index].state != MEYE_BUF_UNUSED) |
@@ -1497,9 +1461,6 @@ static int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) | |||
1497 | { | 1461 | { |
1498 | int reqnr; | 1462 | int reqnr; |
1499 | 1463 | ||
1500 | if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
1501 | return -EINVAL; | ||
1502 | |||
1503 | if (buf->memory != V4L2_MEMORY_MMAP) | 1464 | if (buf->memory != V4L2_MEMORY_MMAP) |
1504 | return -EINVAL; | 1465 | return -EINVAL; |
1505 | 1466 | ||