diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-06-03 04:36:50 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-06-17 08:39:53 -0400 |
commit | ca37157506ef53dcf41132aaedab70659509ccee (patch) | |
tree | fe446691366fe20d7b579bb390a94efe7f778384 /drivers/media/v4l2-core | |
parent | 8f73d3bbf8b1114b1ae5ac8950104b3d5d01c7d2 (diff) |
[media] v4l2: remove deprecated current_norm support completely
The use of current_norm to keep track of the current standard has been
deprecated for quite some time. Now that all drivers that were using it
have been converted to use g_std we can drop it from the core.
It was a bad idea to introduce this at the time: since it is a per-device
node field it didn't work for drivers that create multiple nodes, all sharing
the same tuner (e.g. video and vbi nodes, or a raw video node and a compressed
video node). In addition it was very surprising behavior that g_std was
implemented in the core. Often drivers implemented both g_std and current_norm,
because they didn't understand how it should be used.
Since the benefits were very limited (if they were there at all), it is better
to just drop it and require that drivers just implement g_std.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-dev.c | 5 | ||||
-rw-r--r-- | drivers/media/v4l2-core/v4l2-ioctl.c | 34 |
2 files changed, 6 insertions, 33 deletions
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 5923c5dfacd5..2f3fac5345db 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c | |||
@@ -675,9 +675,8 @@ static void determine_valid_ioctls(struct video_device *vdev) | |||
675 | SET_VALID_IOCTL(ops, VIDIOC_PREPARE_BUF, vidioc_prepare_buf); | 675 | SET_VALID_IOCTL(ops, VIDIOC_PREPARE_BUF, vidioc_prepare_buf); |
676 | if (ops->vidioc_s_std) | 676 | if (ops->vidioc_s_std) |
677 | set_bit(_IOC_NR(VIDIOC_ENUMSTD), valid_ioctls); | 677 | set_bit(_IOC_NR(VIDIOC_ENUMSTD), valid_ioctls); |
678 | if (ops->vidioc_g_std || vdev->current_norm) | ||
679 | set_bit(_IOC_NR(VIDIOC_G_STD), valid_ioctls); | ||
680 | SET_VALID_IOCTL(ops, VIDIOC_S_STD, vidioc_s_std); | 678 | SET_VALID_IOCTL(ops, VIDIOC_S_STD, vidioc_s_std); |
679 | SET_VALID_IOCTL(ops, VIDIOC_G_STD, vidioc_g_std); | ||
681 | if (is_rx) { | 680 | if (is_rx) { |
682 | SET_VALID_IOCTL(ops, VIDIOC_QUERYSTD, vidioc_querystd); | 681 | SET_VALID_IOCTL(ops, VIDIOC_QUERYSTD, vidioc_querystd); |
683 | SET_VALID_IOCTL(ops, VIDIOC_ENUMINPUT, vidioc_enum_input); | 682 | SET_VALID_IOCTL(ops, VIDIOC_ENUMINPUT, vidioc_enum_input); |
@@ -705,7 +704,7 @@ static void determine_valid_ioctls(struct video_device *vdev) | |||
705 | if (ops->vidioc_cropcap || ops->vidioc_g_selection) | 704 | if (ops->vidioc_cropcap || ops->vidioc_g_selection) |
706 | set_bit(_IOC_NR(VIDIOC_CROPCAP), valid_ioctls); | 705 | set_bit(_IOC_NR(VIDIOC_CROPCAP), valid_ioctls); |
707 | if (ops->vidioc_g_parm || (vdev->vfl_type == VFL_TYPE_GRABBER && | 706 | if (ops->vidioc_g_parm || (vdev->vfl_type == VFL_TYPE_GRABBER && |
708 | (ops->vidioc_g_std || vdev->current_norm))) | 707 | ops->vidioc_g_std)) |
709 | set_bit(_IOC_NR(VIDIOC_G_PARM), valid_ioctls); | 708 | set_bit(_IOC_NR(VIDIOC_G_PARM), valid_ioctls); |
710 | SET_VALID_IOCTL(ops, VIDIOC_S_PARM, vidioc_s_parm); | 709 | SET_VALID_IOCTL(ops, VIDIOC_S_PARM, vidioc_s_parm); |
711 | SET_VALID_IOCTL(ops, VIDIOC_S_DV_TIMINGS, vidioc_s_dv_timings); | 710 | SET_VALID_IOCTL(ops, VIDIOC_S_DV_TIMINGS, vidioc_s_dv_timings); |
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 60b8c259da96..67745438e6ff 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c | |||
@@ -1364,40 +1364,18 @@ static int v4l_enumstd(const struct v4l2_ioctl_ops *ops, | |||
1364 | return 0; | 1364 | return 0; |
1365 | } | 1365 | } |
1366 | 1366 | ||
1367 | static int v4l_g_std(const struct v4l2_ioctl_ops *ops, | ||
1368 | struct file *file, void *fh, void *arg) | ||
1369 | { | ||
1370 | struct video_device *vfd = video_devdata(file); | ||
1371 | v4l2_std_id *id = arg; | ||
1372 | |||
1373 | /* Calls the specific handler */ | ||
1374 | if (ops->vidioc_g_std) | ||
1375 | return ops->vidioc_g_std(file, fh, arg); | ||
1376 | if (vfd->current_norm) { | ||
1377 | *id = vfd->current_norm; | ||
1378 | return 0; | ||
1379 | } | ||
1380 | return -ENOTTY; | ||
1381 | } | ||
1382 | |||
1383 | static int v4l_s_std(const struct v4l2_ioctl_ops *ops, | 1367 | static int v4l_s_std(const struct v4l2_ioctl_ops *ops, |
1384 | struct file *file, void *fh, void *arg) | 1368 | struct file *file, void *fh, void *arg) |
1385 | { | 1369 | { |
1386 | struct video_device *vfd = video_devdata(file); | 1370 | struct video_device *vfd = video_devdata(file); |
1387 | v4l2_std_id id = *(v4l2_std_id *)arg, norm; | 1371 | v4l2_std_id id = *(v4l2_std_id *)arg, norm; |
1388 | int ret; | ||
1389 | 1372 | ||
1390 | norm = id & vfd->tvnorms; | 1373 | norm = id & vfd->tvnorms; |
1391 | if (vfd->tvnorms && !norm) /* Check if std is supported */ | 1374 | if (vfd->tvnorms && !norm) /* Check if std is supported */ |
1392 | return -EINVAL; | 1375 | return -EINVAL; |
1393 | 1376 | ||
1394 | /* Calls the specific handler */ | 1377 | /* Calls the specific handler */ |
1395 | ret = ops->vidioc_s_std(file, fh, norm); | 1378 | return ops->vidioc_s_std(file, fh, norm); |
1396 | |||
1397 | /* Updates standard information */ | ||
1398 | if (ret >= 0) | ||
1399 | vfd->current_norm = norm; | ||
1400 | return ret; | ||
1401 | } | 1379 | } |
1402 | 1380 | ||
1403 | static int v4l_querystd(const struct v4l2_ioctl_ops *ops, | 1381 | static int v4l_querystd(const struct v4l2_ioctl_ops *ops, |
@@ -1500,7 +1478,6 @@ static int v4l_prepare_buf(const struct v4l2_ioctl_ops *ops, | |||
1500 | static int v4l_g_parm(const struct v4l2_ioctl_ops *ops, | 1478 | static int v4l_g_parm(const struct v4l2_ioctl_ops *ops, |
1501 | struct file *file, void *fh, void *arg) | 1479 | struct file *file, void *fh, void *arg) |
1502 | { | 1480 | { |
1503 | struct video_device *vfd = video_devdata(file); | ||
1504 | struct v4l2_streamparm *p = arg; | 1481 | struct v4l2_streamparm *p = arg; |
1505 | v4l2_std_id std; | 1482 | v4l2_std_id std; |
1506 | int ret = check_fmt(file, p->type); | 1483 | int ret = check_fmt(file, p->type); |
@@ -1509,16 +1486,13 @@ static int v4l_g_parm(const struct v4l2_ioctl_ops *ops, | |||
1509 | return ret; | 1486 | return ret; |
1510 | if (ops->vidioc_g_parm) | 1487 | if (ops->vidioc_g_parm) |
1511 | return ops->vidioc_g_parm(file, fh, p); | 1488 | return ops->vidioc_g_parm(file, fh, p); |
1512 | std = vfd->current_norm; | ||
1513 | if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && | 1489 | if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && |
1514 | p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) | 1490 | p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) |
1515 | return -EINVAL; | 1491 | return -EINVAL; |
1516 | p->parm.capture.readbuffers = 2; | 1492 | p->parm.capture.readbuffers = 2; |
1517 | if (is_valid_ioctl(vfd, VIDIOC_G_STD) && ops->vidioc_g_std) | 1493 | ret = ops->vidioc_g_std(file, fh, &std); |
1518 | ret = ops->vidioc_g_std(file, fh, &std); | ||
1519 | if (ret == 0) | 1494 | if (ret == 0) |
1520 | v4l2_video_std_frame_period(std, | 1495 | v4l2_video_std_frame_period(std, &p->parm.capture.timeperframe); |
1521 | &p->parm.capture.timeperframe); | ||
1522 | return ret; | 1496 | return ret; |
1523 | } | 1497 | } |
1524 | 1498 | ||
@@ -2055,7 +2029,7 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = { | |||
2055 | IOCTL_INFO_FNC(VIDIOC_STREAMOFF, v4l_streamoff, v4l_print_buftype, INFO_FL_PRIO | INFO_FL_QUEUE), | 2029 | IOCTL_INFO_FNC(VIDIOC_STREAMOFF, v4l_streamoff, v4l_print_buftype, INFO_FL_PRIO | INFO_FL_QUEUE), |
2056 | IOCTL_INFO_FNC(VIDIOC_G_PARM, v4l_g_parm, v4l_print_streamparm, INFO_FL_CLEAR(v4l2_streamparm, type)), | 2030 | IOCTL_INFO_FNC(VIDIOC_G_PARM, v4l_g_parm, v4l_print_streamparm, INFO_FL_CLEAR(v4l2_streamparm, type)), |
2057 | IOCTL_INFO_FNC(VIDIOC_S_PARM, v4l_s_parm, v4l_print_streamparm, INFO_FL_PRIO), | 2031 | IOCTL_INFO_FNC(VIDIOC_S_PARM, v4l_s_parm, v4l_print_streamparm, INFO_FL_PRIO), |
2058 | IOCTL_INFO_FNC(VIDIOC_G_STD, v4l_g_std, v4l_print_std, 0), | 2032 | IOCTL_INFO_STD(VIDIOC_G_STD, vidioc_g_std, v4l_print_std, 0), |
2059 | IOCTL_INFO_FNC(VIDIOC_S_STD, v4l_s_std, v4l_print_std, INFO_FL_PRIO), | 2033 | IOCTL_INFO_FNC(VIDIOC_S_STD, v4l_s_std, v4l_print_std, INFO_FL_PRIO), |
2060 | IOCTL_INFO_FNC(VIDIOC_ENUMSTD, v4l_enumstd, v4l_print_standard, INFO_FL_CLEAR(v4l2_standard, index)), | 2034 | IOCTL_INFO_FNC(VIDIOC_ENUMSTD, v4l_enumstd, v4l_print_standard, INFO_FL_CLEAR(v4l2_standard, index)), |
2061 | IOCTL_INFO_FNC(VIDIOC_ENUMINPUT, v4l_enuminput, v4l_print_enuminput, INFO_FL_CLEAR(v4l2_input, index)), | 2035 | IOCTL_INFO_FNC(VIDIOC_ENUMINPUT, v4l_enuminput, v4l_print_enuminput, INFO_FL_CLEAR(v4l2_input, index)), |