aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c26
-rw-r--r--drivers/media/video/cafe_ccic.c25
-rw-r--r--drivers/media/video/cx18/cx18-ioctl.c92
-rw-r--r--drivers/media/video/cx23885/cx23885-417.c20
-rw-r--r--drivers/media/video/cx23885/cx23885-video.c16
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c16
-rw-r--r--drivers/media/video/cx88/cx88-video.c33
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c46
-rw-r--r--drivers/media/video/gspca/gspca.c16
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c130
-rw-r--r--drivers/media/video/meye.c18
-rw-r--r--drivers/media/video/s2255drv.c16
-rw-r--r--drivers/media/video/saa7134/saa7134-empress.c22
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c61
-rw-r--r--drivers/media/video/soc_camera.c56
-rw-r--r--drivers/media/video/stk-webcam.c31
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c38
-rw-r--r--drivers/media/video/v4l2-ioctl.c418
-rw-r--r--drivers/media/video/vivi.c18
-rw-r--r--drivers/media/video/zr364xx.c19
20 files changed, 606 insertions, 511 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 33c72055447d..dfa399da587d 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -3358,10 +3358,7 @@ static const struct file_operations bttv_fops =
3358 .poll = bttv_poll, 3358 .poll = bttv_poll,
3359}; 3359};
3360 3360
3361static struct video_device bttv_video_template = 3361static const struct v4l2_ioctl_ops bttv_ioctl_ops = {
3362{
3363 .fops = &bttv_fops,
3364 .minor = -1,
3365 .vidioc_querycap = bttv_querycap, 3362 .vidioc_querycap = bttv_querycap,
3366 .vidioc_enum_fmt_vid_cap = bttv_enum_fmt_vid_cap, 3363 .vidioc_enum_fmt_vid_cap = bttv_enum_fmt_vid_cap,
3367 .vidioc_g_fmt_vid_cap = bttv_g_fmt_vid_cap, 3364 .vidioc_g_fmt_vid_cap = bttv_g_fmt_vid_cap,
@@ -3412,8 +3409,14 @@ static struct video_device bttv_video_template =
3412 .vidioc_g_register = bttv_g_register, 3409 .vidioc_g_register = bttv_g_register,
3413 .vidioc_s_register = bttv_s_register, 3410 .vidioc_s_register = bttv_s_register,
3414#endif 3411#endif
3415 .tvnorms = BTTV_NORMS, 3412};
3416 .current_norm = V4L2_STD_PAL, 3413
3414static struct video_device bttv_video_template = {
3415 .fops = &bttv_fops,
3416 .minor = -1,
3417 .ioctl_ops = &bttv_ioctl_ops,
3418 .tvnorms = BTTV_NORMS,
3419 .current_norm = V4L2_STD_PAL,
3417}; 3420};
3418 3421
3419/* ----------------------------------------------------------------------- */ 3422/* ----------------------------------------------------------------------- */
@@ -3636,10 +3639,7 @@ static const struct file_operations radio_fops =
3636 .poll = radio_poll, 3639 .poll = radio_poll,
3637}; 3640};
3638 3641
3639static struct video_device radio_template = 3642static const struct v4l2_ioctl_ops radio_ioctl_ops = {
3640{
3641 .fops = &radio_fops,
3642 .minor = -1,
3643 .vidioc_querycap = radio_querycap, 3643 .vidioc_querycap = radio_querycap,
3644 .vidioc_g_tuner = radio_g_tuner, 3644 .vidioc_g_tuner = radio_g_tuner,
3645 .vidioc_enum_input = radio_enum_input, 3645 .vidioc_enum_input = radio_enum_input,
@@ -3656,6 +3656,12 @@ static struct video_device radio_template =
3656 .vidioc_s_frequency = bttv_s_frequency, 3656 .vidioc_s_frequency = bttv_s_frequency,
3657}; 3657};
3658 3658
3659static struct video_device radio_template = {
3660 .fops = &radio_fops,
3661 .minor = -1,
3662 .ioctl_ops = &radio_ioctl_ops,
3663};
3664
3659/* ----------------------------------------------------------------------- */ 3665/* ----------------------------------------------------------------------- */
3660/* some debug code */ 3666/* some debug code */
3661 3667
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index 302c57f151c2..4bbea458d0c0 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -1769,17 +1769,7 @@ static const struct file_operations cafe_v4l_fops = {
1769 .llseek = no_llseek, 1769 .llseek = no_llseek,
1770}; 1770};
1771 1771
1772static struct video_device cafe_v4l_template = { 1772static const struct v4l2_ioctl_ops cafe_v4l_ioctl_ops = {
1773 .name = "cafe",
1774 .type = VFL_TYPE_GRABBER,
1775 .type2 = VID_TYPE_CAPTURE,
1776 .minor = -1, /* Get one dynamically */
1777 .tvnorms = V4L2_STD_NTSC_M,
1778 .current_norm = V4L2_STD_NTSC_M, /* make mplayer happy */
1779
1780 .fops = &cafe_v4l_fops,
1781 .release = cafe_v4l_dev_release,
1782
1783 .vidioc_querycap = cafe_vidioc_querycap, 1773 .vidioc_querycap = cafe_vidioc_querycap,
1784 .vidioc_enum_fmt_vid_cap = cafe_vidioc_enum_fmt_vid_cap, 1774 .vidioc_enum_fmt_vid_cap = cafe_vidioc_enum_fmt_vid_cap,
1785 .vidioc_try_fmt_vid_cap = cafe_vidioc_try_fmt_vid_cap, 1775 .vidioc_try_fmt_vid_cap = cafe_vidioc_try_fmt_vid_cap,
@@ -1802,6 +1792,19 @@ static struct video_device cafe_v4l_template = {
1802 .vidioc_s_parm = cafe_vidioc_s_parm, 1792 .vidioc_s_parm = cafe_vidioc_s_parm,
1803}; 1793};
1804 1794
1795static struct video_device cafe_v4l_template = {
1796 .name = "cafe",
1797 .type = VFL_TYPE_GRABBER,
1798 .type2 = VID_TYPE_CAPTURE,
1799 .minor = -1, /* Get one dynamically */
1800 .tvnorms = V4L2_STD_NTSC_M,
1801 .current_norm = V4L2_STD_NTSC_M, /* make mplayer happy */
1802
1803 .fops = &cafe_v4l_fops,
1804 .ioctl_ops = &cafe_v4l_ioctl_ops,
1805 .release = cafe_v4l_dev_release,
1806};
1807
1805 1808
1806 1809
1807 1810
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c
index 0d74e59e503e..a7f839631d6a 100644
--- a/drivers/media/video/cx18/cx18-ioctl.c
+++ b/drivers/media/video/cx18/cx18-ioctl.c
@@ -787,50 +787,54 @@ int cx18_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
787 return res; 787 return res;
788} 788}
789 789
790void cx18_set_funcs(struct video_device *vdev) 790static const struct v4l2_ioctl_ops cx18_ioctl_ops = {
791{ 791 .vidioc_querycap = cx18_querycap,
792 vdev->vidioc_querycap = cx18_querycap; 792 .vidioc_g_priority = cx18_g_priority,
793 vdev->vidioc_g_priority = cx18_g_priority; 793 .vidioc_s_priority = cx18_s_priority,
794 vdev->vidioc_s_priority = cx18_s_priority; 794 .vidioc_s_audio = cx18_s_audio,
795 vdev->vidioc_s_audio = cx18_s_audio; 795 .vidioc_g_audio = cx18_g_audio,
796 vdev->vidioc_g_audio = cx18_g_audio; 796 .vidioc_enumaudio = cx18_enumaudio,
797 vdev->vidioc_enumaudio = cx18_enumaudio; 797 .vidioc_enum_input = cx18_enum_input,
798 vdev->vidioc_enum_input = cx18_enum_input; 798 .vidioc_cropcap = cx18_cropcap,
799 vdev->vidioc_cropcap = cx18_cropcap; 799 .vidioc_s_crop = cx18_s_crop,
800 vdev->vidioc_s_crop = cx18_s_crop; 800 .vidioc_g_crop = cx18_g_crop,
801 vdev->vidioc_g_crop = cx18_g_crop; 801 .vidioc_g_input = cx18_g_input,
802 vdev->vidioc_g_input = cx18_g_input; 802 .vidioc_s_input = cx18_s_input,
803 vdev->vidioc_s_input = cx18_s_input; 803 .vidioc_g_frequency = cx18_g_frequency,
804 vdev->vidioc_g_frequency = cx18_g_frequency; 804 .vidioc_s_frequency = cx18_s_frequency,
805 vdev->vidioc_s_frequency = cx18_s_frequency; 805 .vidioc_s_tuner = cx18_s_tuner,
806 vdev->vidioc_s_tuner = cx18_s_tuner; 806 .vidioc_g_tuner = cx18_g_tuner,
807 vdev->vidioc_g_tuner = cx18_g_tuner; 807 .vidioc_g_enc_index = cx18_g_enc_index,
808 vdev->vidioc_g_enc_index = cx18_g_enc_index; 808 .vidioc_g_std = cx18_g_std,
809 vdev->vidioc_g_std = cx18_g_std; 809 .vidioc_s_std = cx18_s_std,
810 vdev->vidioc_s_std = cx18_s_std; 810 .vidioc_log_status = cx18_log_status,
811 vdev->vidioc_log_status = cx18_log_status; 811 .vidioc_enum_fmt_vid_cap = cx18_enum_fmt_vid_cap,
812 vdev->vidioc_enum_fmt_vid_cap = cx18_enum_fmt_vid_cap; 812 .vidioc_encoder_cmd = cx18_encoder_cmd,
813 vdev->vidioc_encoder_cmd = cx18_encoder_cmd; 813 .vidioc_try_encoder_cmd = cx18_try_encoder_cmd,
814 vdev->vidioc_try_encoder_cmd = cx18_try_encoder_cmd; 814 .vidioc_g_fmt_vid_cap = cx18_g_fmt_vid_cap,
815 vdev->vidioc_g_fmt_vid_cap = cx18_g_fmt_vid_cap; 815 .vidioc_g_fmt_vbi_cap = cx18_g_fmt_vbi_cap,
816 vdev->vidioc_g_fmt_vbi_cap = cx18_g_fmt_vbi_cap; 816 .vidioc_g_fmt_sliced_vbi_cap = cx18_g_fmt_sliced_vbi_cap,
817 vdev->vidioc_g_fmt_sliced_vbi_cap = cx18_g_fmt_sliced_vbi_cap; 817 .vidioc_s_fmt_vid_cap = cx18_s_fmt_vid_cap,
818 vdev->vidioc_s_fmt_vid_cap = cx18_s_fmt_vid_cap; 818 .vidioc_s_fmt_vbi_cap = cx18_s_fmt_vbi_cap,
819 vdev->vidioc_s_fmt_vbi_cap = cx18_s_fmt_vbi_cap; 819 .vidioc_s_fmt_sliced_vbi_cap = cx18_s_fmt_sliced_vbi_cap,
820 vdev->vidioc_s_fmt_sliced_vbi_cap = cx18_s_fmt_sliced_vbi_cap; 820 .vidioc_try_fmt_vid_cap = cx18_try_fmt_vid_cap,
821 vdev->vidioc_try_fmt_vid_cap = cx18_try_fmt_vid_cap; 821 .vidioc_try_fmt_vbi_cap = cx18_try_fmt_vbi_cap,
822 vdev->vidioc_try_fmt_vbi_cap = cx18_try_fmt_vbi_cap; 822 .vidioc_try_fmt_sliced_vbi_cap = cx18_try_fmt_sliced_vbi_cap,
823 vdev->vidioc_try_fmt_sliced_vbi_cap = cx18_try_fmt_sliced_vbi_cap; 823 .vidioc_g_sliced_vbi_cap = cx18_g_sliced_vbi_cap,
824 vdev->vidioc_g_sliced_vbi_cap = cx18_g_sliced_vbi_cap; 824 .vidioc_g_chip_ident = cx18_g_chip_ident,
825 vdev->vidioc_g_chip_ident = cx18_g_chip_ident;
826#ifdef CONFIG_VIDEO_ADV_DEBUG 825#ifdef CONFIG_VIDEO_ADV_DEBUG
827 vdev->vidioc_g_register = cx18_g_register; 826 .vidioc_g_register = cx18_g_register,
828 vdev->vidioc_s_register = cx18_s_register; 827 .vidioc_s_register = cx18_s_register,
829#endif 828#endif
830 vdev->vidioc_default = cx18_default; 829 .vidioc_default = cx18_default,
831 vdev->vidioc_queryctrl = cx18_queryctrl; 830 .vidioc_queryctrl = cx18_queryctrl,
832 vdev->vidioc_querymenu = cx18_querymenu; 831 .vidioc_querymenu = cx18_querymenu,
833 vdev->vidioc_g_ext_ctrls = cx18_g_ext_ctrls; 832 .vidioc_g_ext_ctrls = cx18_g_ext_ctrls,
834 vdev->vidioc_s_ext_ctrls = cx18_s_ext_ctrls; 833 .vidioc_s_ext_ctrls = cx18_s_ext_ctrls,
835 vdev->vidioc_try_ext_ctrls = cx18_try_ext_ctrls; 834 .vidioc_try_ext_ctrls = cx18_try_ext_ctrls,
835};
836
837void cx18_set_funcs(struct video_device *vdev)
838{
839 vdev->ioctl_ops = &cx18_ioctl_ops;
836} 840}
diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c
index 4d0dcb06c19d..9d15d8a353fa 100644
--- a/drivers/media/video/cx23885/cx23885-417.c
+++ b/drivers/media/video/cx23885/cx23885-417.c
@@ -1700,14 +1700,7 @@ static struct file_operations mpeg_fops = {
1700 .llseek = no_llseek, 1700 .llseek = no_llseek,
1701}; 1701};
1702 1702
1703static struct video_device cx23885_mpeg_template = { 1703static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
1704 .name = "cx23885",
1705 .type = VID_TYPE_CAPTURE |
1706 VID_TYPE_TUNER |
1707 VID_TYPE_SCALES |
1708 VID_TYPE_MPEG_ENCODER,
1709 .fops = &mpeg_fops,
1710 .minor = -1,
1711 .vidioc_s_std = vidioc_s_std, 1704 .vidioc_s_std = vidioc_s_std,
1712 .vidioc_enum_input = vidioc_enum_input, 1705 .vidioc_enum_input = vidioc_enum_input,
1713 .vidioc_g_input = vidioc_g_input, 1706 .vidioc_g_input = vidioc_g_input,
@@ -1736,6 +1729,17 @@ static struct video_device cx23885_mpeg_template = {
1736 .vidioc_queryctrl = vidioc_queryctrl, 1729 .vidioc_queryctrl = vidioc_queryctrl,
1737}; 1730};
1738 1731
1732static struct video_device cx23885_mpeg_template = {
1733 .name = "cx23885",
1734 .type = VID_TYPE_CAPTURE |
1735 VID_TYPE_TUNER |
1736 VID_TYPE_SCALES |
1737 VID_TYPE_MPEG_ENCODER,
1738 .fops = &mpeg_fops,
1739 .ioctl_ops = &mpeg_ioctl_ops,
1740 .minor = -1,
1741};
1742
1739void cx23885_417_unregister(struct cx23885_dev *dev) 1743void cx23885_417_unregister(struct cx23885_dev *dev)
1740{ 1744{
1741 dprintk(1, "%s()\n", __func__); 1745 dprintk(1, "%s()\n", __func__);
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c
index 245712e45f69..308caa2085ba 100644
--- a/drivers/media/video/cx23885/cx23885-video.c
+++ b/drivers/media/video/cx23885/cx23885-video.c
@@ -1434,12 +1434,7 @@ static const struct file_operations video_fops = {
1434 .llseek = no_llseek, 1434 .llseek = no_llseek,
1435}; 1435};
1436 1436
1437static struct video_device cx23885_vbi_template; 1437static const struct v4l2_ioctl_ops video_ioctl_ops = {
1438static struct video_device cx23885_video_template = {
1439 .name = "cx23885-video",
1440 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_SCALES,
1441 .fops = &video_fops,
1442 .minor = -1,
1443 .vidioc_querycap = vidioc_querycap, 1438 .vidioc_querycap = vidioc_querycap,
1444 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 1439 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
1445 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 1440 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
@@ -1472,6 +1467,15 @@ static struct video_device cx23885_video_template = {
1472 .vidioc_g_register = vidioc_g_register, 1467 .vidioc_g_register = vidioc_g_register,
1473 .vidioc_s_register = vidioc_s_register, 1468 .vidioc_s_register = vidioc_s_register,
1474#endif 1469#endif
1470};
1471
1472static struct video_device cx23885_vbi_template;
1473static struct video_device cx23885_video_template = {
1474 .name = "cx23885-video",
1475 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_SCALES,
1476 .fops = &video_fops,
1477 .minor = -1,
1478 .ioctl_ops = &video_ioctl_ops,
1475 .tvnorms = CX23885_NORMS, 1479 .tvnorms = CX23885_NORMS,
1476 .current_norm = V4L2_STD_NTSC_M, 1480 .current_norm = V4L2_STD_NTSC_M,
1477}; 1481};
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index 4d1a461f329f..55c35482089e 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1175,12 +1175,7 @@ static const struct file_operations mpeg_fops =
1175 .llseek = no_llseek, 1175 .llseek = no_llseek,
1176}; 1176};
1177 1177
1178static struct video_device cx8802_mpeg_template = 1178static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
1179{
1180 .name = "cx8802",
1181 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_SCALES|VID_TYPE_MPEG_ENCODER,
1182 .fops = &mpeg_fops,
1183 .minor = -1,
1184 .vidioc_querymenu = vidioc_querymenu, 1179 .vidioc_querymenu = vidioc_querymenu,
1185 .vidioc_querycap = vidioc_querycap, 1180 .vidioc_querycap = vidioc_querycap,
1186 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 1181 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
@@ -1208,6 +1203,15 @@ static struct video_device cx8802_mpeg_template =
1208 .vidioc_g_tuner = vidioc_g_tuner, 1203 .vidioc_g_tuner = vidioc_g_tuner,
1209 .vidioc_s_tuner = vidioc_s_tuner, 1204 .vidioc_s_tuner = vidioc_s_tuner,
1210 .vidioc_s_std = vidioc_s_std, 1205 .vidioc_s_std = vidioc_s_std,
1206};
1207
1208static struct video_device cx8802_mpeg_template = {
1209 .name = "cx8802",
1210 .type = VID_TYPE_CAPTURE | VID_TYPE_TUNER |
1211 VID_TYPE_SCALES | VID_TYPE_MPEG_ENCODER,
1212 .fops = &mpeg_fops,
1213 .ioctl_ops = &mpeg_ioctl_ops,
1214 .minor = -1,
1211 .tvnorms = CX88_NORMS, 1215 .tvnorms = CX88_NORMS,
1212 .current_norm = V4L2_STD_NTSC_M, 1216 .current_norm = V4L2_STD_NTSC_M,
1213}; 1217};
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index f8cc55db9f42..24b403b238d1 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -1683,13 +1683,7 @@ static const struct file_operations video_fops =
1683 .llseek = no_llseek, 1683 .llseek = no_llseek,
1684}; 1684};
1685 1685
1686static struct video_device cx8800_vbi_template; 1686static const struct v4l2_ioctl_ops video_ioctl_ops = {
1687static struct video_device cx8800_video_template =
1688{
1689 .name = "cx8800-video",
1690 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_SCALES,
1691 .fops = &video_fops,
1692 .minor = -1,
1693 .vidioc_querycap = vidioc_querycap, 1687 .vidioc_querycap = vidioc_querycap,
1694 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 1688 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
1695 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 1689 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
@@ -1722,6 +1716,16 @@ static struct video_device cx8800_video_template =
1722 .vidioc_g_register = vidioc_g_register, 1716 .vidioc_g_register = vidioc_g_register,
1723 .vidioc_s_register = vidioc_s_register, 1717 .vidioc_s_register = vidioc_s_register,
1724#endif 1718#endif
1719};
1720
1721static struct video_device cx8800_vbi_template;
1722
1723static struct video_device cx8800_video_template = {
1724 .name = "cx8800-video",
1725 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_SCALES,
1726 .fops = &video_fops,
1727 .minor = -1,
1728 .ioctl_ops = &video_ioctl_ops,
1725 .tvnorms = CX88_NORMS, 1729 .tvnorms = CX88_NORMS,
1726 .current_norm = V4L2_STD_NTSC_M, 1730 .current_norm = V4L2_STD_NTSC_M,
1727}; 1731};
@@ -1736,12 +1740,7 @@ static const struct file_operations radio_fops =
1736 .llseek = no_llseek, 1740 .llseek = no_llseek,
1737}; 1741};
1738 1742
1739static struct video_device cx8800_radio_template = 1743static const struct v4l2_ioctl_ops radio_ioctl_ops = {
1740{
1741 .name = "cx8800-radio",
1742 .type = VID_TYPE_TUNER,
1743 .fops = &radio_fops,
1744 .minor = -1,
1745 .vidioc_querycap = radio_querycap, 1744 .vidioc_querycap = radio_querycap,
1746 .vidioc_g_tuner = radio_g_tuner, 1745 .vidioc_g_tuner = radio_g_tuner,
1747 .vidioc_enum_input = radio_enum_input, 1746 .vidioc_enum_input = radio_enum_input,
@@ -1760,6 +1759,14 @@ static struct video_device cx8800_radio_template =
1760#endif 1759#endif
1761}; 1760};
1762 1761
1762static struct video_device cx8800_radio_template = {
1763 .name = "cx8800-radio",
1764 .type = VID_TYPE_TUNER,
1765 .fops = &radio_fops,
1766 .minor = -1,
1767 .ioctl_ops = &radio_ioctl_ops,
1768};
1769
1763/* ----------------------------------------------------------- */ 1770/* ----------------------------------------------------------- */
1764 1771
1765static void cx8800_unregister_video(struct cx8800_dev *dev) 1772static void cx8800_unregister_video(struct cx8800_dev *dev)
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 67c62eaa5b6d..fcfc7413f74c 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1764,20 +1764,7 @@ static const struct file_operations em28xx_v4l_fops = {
1764 .compat_ioctl = v4l_compat_ioctl32, 1764 .compat_ioctl = v4l_compat_ioctl32,
1765}; 1765};
1766 1766
1767static const struct file_operations radio_fops = { 1767static const struct v4l2_ioctl_ops video_ioctl_ops = {
1768 .owner = THIS_MODULE,
1769 .open = em28xx_v4l2_open,
1770 .release = em28xx_v4l2_close,
1771 .ioctl = video_ioctl2,
1772 .compat_ioctl = v4l_compat_ioctl32,
1773 .llseek = no_llseek,
1774};
1775
1776static const struct video_device em28xx_video_template = {
1777 .fops = &em28xx_v4l_fops,
1778 .release = video_device_release,
1779
1780 .minor = -1,
1781 .vidioc_querycap = vidioc_querycap, 1768 .vidioc_querycap = vidioc_querycap,
1782 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 1769 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
1783 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 1770 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
@@ -1815,16 +1802,29 @@ static const struct video_device em28xx_video_template = {
1815#ifdef CONFIG_VIDEO_V4L1_COMPAT 1802#ifdef CONFIG_VIDEO_V4L1_COMPAT
1816 .vidiocgmbuf = vidiocgmbuf, 1803 .vidiocgmbuf = vidiocgmbuf,
1817#endif 1804#endif
1805};
1806
1807static const struct video_device em28xx_video_template = {
1808 .fops = &em28xx_v4l_fops,
1809 .release = video_device_release,
1810 .ioctl_ops = &video_ioctl_ops,
1811
1812 .minor = -1,
1818 1813
1819 .tvnorms = V4L2_STD_ALL, 1814 .tvnorms = V4L2_STD_ALL,
1820 .current_norm = V4L2_STD_PAL, 1815 .current_norm = V4L2_STD_PAL,
1821}; 1816};
1822 1817
1823static struct video_device em28xx_radio_template = { 1818static const struct file_operations radio_fops = {
1824 .name = "em28xx-radio", 1819 .owner = THIS_MODULE,
1825 .type = VID_TYPE_TUNER, 1820 .open = em28xx_v4l2_open,
1826 .fops = &radio_fops, 1821 .release = em28xx_v4l2_close,
1827 .minor = -1, 1822 .ioctl = video_ioctl2,
1823 .compat_ioctl = v4l_compat_ioctl32,
1824 .llseek = no_llseek,
1825};
1826
1827static const struct v4l2_ioctl_ops radio_ioctl_ops = {
1828 .vidioc_querycap = radio_querycap, 1828 .vidioc_querycap = radio_querycap,
1829 .vidioc_g_tuner = radio_g_tuner, 1829 .vidioc_g_tuner = radio_g_tuner,
1830 .vidioc_enum_input = radio_enum_input, 1830 .vidioc_enum_input = radio_enum_input,
@@ -1843,6 +1843,14 @@ static struct video_device em28xx_radio_template = {
1843#endif 1843#endif
1844}; 1844};
1845 1845
1846static struct video_device em28xx_radio_template = {
1847 .name = "em28xx-radio",
1848 .type = VID_TYPE_TUNER,
1849 .fops = &radio_fops,
1850 .ioctl_ops = &radio_ioctl_ops,
1851 .minor = -1,
1852};
1853
1846/******************************** usb interface ******************************/ 1854/******************************** usb interface ******************************/
1847 1855
1848 1856
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 0f09784631ad..2a416cf205aa 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -1651,12 +1651,7 @@ static struct file_operations dev_fops = {
1651 .poll = dev_poll, 1651 .poll = dev_poll,
1652}; 1652};
1653 1653
1654static struct video_device gspca_template = { 1654static const struct v4l2_ioctl_ops dev_ioctl_ops = {
1655 .name = "gspca main driver",
1656 .type = VID_TYPE_CAPTURE,
1657 .fops = &dev_fops,
1658 .release = dev_release, /* mandatory */
1659 .minor = -1,
1660 .vidioc_querycap = vidioc_querycap, 1655 .vidioc_querycap = vidioc_querycap,
1661 .vidioc_dqbuf = vidioc_dqbuf, 1656 .vidioc_dqbuf = vidioc_dqbuf,
1662 .vidioc_qbuf = vidioc_qbuf, 1657 .vidioc_qbuf = vidioc_qbuf,
@@ -1685,6 +1680,15 @@ static struct video_device gspca_template = {
1685#endif 1680#endif
1686}; 1681};
1687 1682
1683static struct video_device gspca_template = {
1684 .name = "gspca main driver",
1685 .type = VID_TYPE_CAPTURE,
1686 .fops = &dev_fops,
1687 .ioctl_ops = &dev_ioctl_ops,
1688 .release = dev_release, /* mandatory */
1689 .minor = -1,
1690};
1691
1688/* 1692/*
1689 * probe and create a new gspca device 1693 * probe and create a new gspca device
1690 * 1694 *
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index 52e00a7f3110..61030309d0ad 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -1842,69 +1842,73 @@ int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1842 return res; 1842 return res;
1843} 1843}
1844 1844
1845void ivtv_set_funcs(struct video_device *vdev) 1845static const struct v4l2_ioctl_ops ivtv_ioctl_ops = {
1846{ 1846 .vidioc_querycap = ivtv_querycap,
1847 vdev->vidioc_querycap = ivtv_querycap; 1847 .vidioc_g_priority = ivtv_g_priority,
1848 vdev->vidioc_g_priority = ivtv_g_priority; 1848 .vidioc_s_priority = ivtv_s_priority,
1849 vdev->vidioc_s_priority = ivtv_s_priority; 1849 .vidioc_s_audio = ivtv_s_audio,
1850 vdev->vidioc_s_audio = ivtv_s_audio; 1850 .vidioc_g_audio = ivtv_g_audio,
1851 vdev->vidioc_g_audio = ivtv_g_audio; 1851 .vidioc_enumaudio = ivtv_enumaudio,
1852 vdev->vidioc_enumaudio = ivtv_enumaudio; 1852 .vidioc_s_audout = ivtv_s_audout,
1853 vdev->vidioc_s_audout = ivtv_s_audout; 1853 .vidioc_g_audout = ivtv_g_audout,
1854 vdev->vidioc_g_audout = ivtv_g_audout; 1854 .vidioc_enum_input = ivtv_enum_input,
1855 vdev->vidioc_enum_input = ivtv_enum_input; 1855 .vidioc_enum_output = ivtv_enum_output,
1856 vdev->vidioc_enum_output = ivtv_enum_output; 1856 .vidioc_enumaudout = ivtv_enumaudout,
1857 vdev->vidioc_enumaudout = ivtv_enumaudout; 1857 .vidioc_cropcap = ivtv_cropcap,
1858 vdev->vidioc_cropcap = ivtv_cropcap; 1858 .vidioc_s_crop = ivtv_s_crop,
1859 vdev->vidioc_s_crop = ivtv_s_crop; 1859 .vidioc_g_crop = ivtv_g_crop,
1860 vdev->vidioc_g_crop = ivtv_g_crop; 1860 .vidioc_g_input = ivtv_g_input,
1861 vdev->vidioc_g_input = ivtv_g_input; 1861 .vidioc_s_input = ivtv_s_input,
1862 vdev->vidioc_s_input = ivtv_s_input; 1862 .vidioc_g_output = ivtv_g_output,
1863 vdev->vidioc_g_output = ivtv_g_output; 1863 .vidioc_s_output = ivtv_s_output,
1864 vdev->vidioc_s_output = ivtv_s_output; 1864 .vidioc_g_frequency = ivtv_g_frequency,
1865 vdev->vidioc_g_frequency = ivtv_g_frequency; 1865 .vidioc_s_frequency = ivtv_s_frequency,
1866 vdev->vidioc_s_frequency = ivtv_s_frequency; 1866 .vidioc_s_tuner = ivtv_s_tuner,
1867 vdev->vidioc_s_tuner = ivtv_s_tuner; 1867 .vidioc_g_tuner = ivtv_g_tuner,
1868 vdev->vidioc_g_tuner = ivtv_g_tuner; 1868 .vidioc_g_enc_index = ivtv_g_enc_index,
1869 vdev->vidioc_g_enc_index = ivtv_g_enc_index; 1869 .vidioc_g_fbuf = ivtv_g_fbuf,
1870 vdev->vidioc_g_fbuf = ivtv_g_fbuf; 1870 .vidioc_s_fbuf = ivtv_s_fbuf,
1871 vdev->vidioc_s_fbuf = ivtv_s_fbuf; 1871 .vidioc_g_std = ivtv_g_std,
1872 vdev->vidioc_g_std = ivtv_g_std; 1872 .vidioc_s_std = ivtv_s_std,
1873 vdev->vidioc_s_std = ivtv_s_std; 1873 .vidioc_overlay = ivtv_overlay,
1874 vdev->vidioc_overlay = ivtv_overlay; 1874 .vidioc_log_status = ivtv_log_status,
1875 vdev->vidioc_log_status = ivtv_log_status; 1875 .vidioc_enum_fmt_vid_cap = ivtv_enum_fmt_vid_cap,
1876 vdev->vidioc_enum_fmt_vid_cap = ivtv_enum_fmt_vid_cap; 1876 .vidioc_encoder_cmd = ivtv_encoder_cmd,
1877 vdev->vidioc_encoder_cmd = ivtv_encoder_cmd; 1877 .vidioc_try_encoder_cmd = ivtv_try_encoder_cmd,
1878 vdev->vidioc_try_encoder_cmd = ivtv_try_encoder_cmd; 1878 .vidioc_enum_fmt_vid_out = ivtv_enum_fmt_vid_out,
1879 vdev->vidioc_enum_fmt_vid_out = ivtv_enum_fmt_vid_out; 1879 .vidioc_g_fmt_vid_cap = ivtv_g_fmt_vid_cap,
1880 vdev->vidioc_g_fmt_vid_cap = ivtv_g_fmt_vid_cap; 1880 .vidioc_g_fmt_vbi_cap = ivtv_g_fmt_vbi_cap,
1881 vdev->vidioc_g_fmt_vbi_cap = ivtv_g_fmt_vbi_cap; 1881 .vidioc_g_fmt_sliced_vbi_cap = ivtv_g_fmt_sliced_vbi_cap,
1882 vdev->vidioc_g_fmt_sliced_vbi_cap = ivtv_g_fmt_sliced_vbi_cap; 1882 .vidioc_g_fmt_vid_out = ivtv_g_fmt_vid_out,
1883 vdev->vidioc_g_fmt_vid_out = ivtv_g_fmt_vid_out; 1883 .vidioc_g_fmt_vid_out_overlay = ivtv_g_fmt_vid_out_overlay,
1884 vdev->vidioc_g_fmt_vid_out_overlay = ivtv_g_fmt_vid_out_overlay; 1884 .vidioc_g_fmt_sliced_vbi_out = ivtv_g_fmt_sliced_vbi_out,
1885 vdev->vidioc_g_fmt_sliced_vbi_out = ivtv_g_fmt_sliced_vbi_out; 1885 .vidioc_s_fmt_vid_cap = ivtv_s_fmt_vid_cap,
1886 vdev->vidioc_s_fmt_vid_cap = ivtv_s_fmt_vid_cap; 1886 .vidioc_s_fmt_vbi_cap = ivtv_s_fmt_vbi_cap,
1887 vdev->vidioc_s_fmt_vbi_cap = ivtv_s_fmt_vbi_cap; 1887 .vidioc_s_fmt_sliced_vbi_cap = ivtv_s_fmt_sliced_vbi_cap,
1888 vdev->vidioc_s_fmt_sliced_vbi_cap = ivtv_s_fmt_sliced_vbi_cap; 1888 .vidioc_s_fmt_vid_out = ivtv_s_fmt_vid_out,
1889 vdev->vidioc_s_fmt_vid_out = ivtv_s_fmt_vid_out; 1889 .vidioc_s_fmt_vid_out_overlay = ivtv_s_fmt_vid_out_overlay,
1890 vdev->vidioc_s_fmt_vid_out_overlay = ivtv_s_fmt_vid_out_overlay; 1890 .vidioc_s_fmt_sliced_vbi_out = ivtv_s_fmt_sliced_vbi_out,
1891 vdev->vidioc_s_fmt_sliced_vbi_out = ivtv_s_fmt_sliced_vbi_out; 1891 .vidioc_try_fmt_vid_cap = ivtv_try_fmt_vid_cap,
1892 vdev->vidioc_try_fmt_vid_cap = ivtv_try_fmt_vid_cap; 1892 .vidioc_try_fmt_vbi_cap = ivtv_try_fmt_vbi_cap,
1893 vdev->vidioc_try_fmt_vbi_cap = ivtv_try_fmt_vbi_cap; 1893 .vidioc_try_fmt_sliced_vbi_cap = ivtv_try_fmt_sliced_vbi_cap,
1894 vdev->vidioc_try_fmt_sliced_vbi_cap = ivtv_try_fmt_sliced_vbi_cap; 1894 .vidioc_try_fmt_vid_out = ivtv_try_fmt_vid_out,
1895 vdev->vidioc_try_fmt_vid_out = ivtv_try_fmt_vid_out; 1895 .vidioc_try_fmt_vid_out_overlay = ivtv_try_fmt_vid_out_overlay,
1896 vdev->vidioc_try_fmt_vid_out_overlay = ivtv_try_fmt_vid_out_overlay; 1896 .vidioc_try_fmt_sliced_vbi_out = ivtv_try_fmt_sliced_vbi_out,
1897 vdev->vidioc_try_fmt_sliced_vbi_out = ivtv_try_fmt_sliced_vbi_out; 1897 .vidioc_g_sliced_vbi_cap = ivtv_g_sliced_vbi_cap,
1898 vdev->vidioc_g_sliced_vbi_cap = ivtv_g_sliced_vbi_cap; 1898 .vidioc_g_chip_ident = ivtv_g_chip_ident,
1899 vdev->vidioc_g_chip_ident = ivtv_g_chip_ident;
1900#ifdef CONFIG_VIDEO_ADV_DEBUG 1899#ifdef CONFIG_VIDEO_ADV_DEBUG
1901 vdev->vidioc_g_register = ivtv_g_register; 1900 .vidioc_g_register = ivtv_g_register,
1902 vdev->vidioc_s_register = ivtv_s_register; 1901 .vidioc_s_register = ivtv_s_register,
1903#endif 1902#endif
1904 vdev->vidioc_default = ivtv_default; 1903 .vidioc_default = ivtv_default,
1905 vdev->vidioc_queryctrl = ivtv_queryctrl; 1904 .vidioc_queryctrl = ivtv_queryctrl,
1906 vdev->vidioc_querymenu = ivtv_querymenu; 1905 .vidioc_querymenu = ivtv_querymenu,
1907 vdev->vidioc_g_ext_ctrls = ivtv_g_ext_ctrls; 1906 .vidioc_g_ext_ctrls = ivtv_g_ext_ctrls,
1908 vdev->vidioc_s_ext_ctrls = ivtv_s_ext_ctrls; 1907 .vidioc_s_ext_ctrls = ivtv_s_ext_ctrls,
1909 vdev->vidioc_try_ext_ctrls = ivtv_try_ext_ctrls; 1908 .vidioc_try_ext_ctrls = ivtv_try_ext_ctrls,
1909};
1910
1911void ivtv_set_funcs(struct video_device *vdev)
1912{
1913 vdev->ioctl_ops = &ivtv_ioctl_ops;
1910} 1914}
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c
index a1fb9874fdcf..fd16ef0a5868 100644
--- a/drivers/media/video/meye.c
+++ b/drivers/media/video/meye.c
@@ -1698,13 +1698,7 @@ static const struct file_operations meye_fops = {
1698 .llseek = no_llseek, 1698 .llseek = no_llseek,
1699}; 1699};
1700 1700
1701static struct video_device meye_template = { 1701static const struct v4l2_ioctl_ops meye_ioctl_ops = {
1702 .owner = THIS_MODULE,
1703 .name = "meye",
1704 .type = VID_TYPE_CAPTURE,
1705 .fops = &meye_fops,
1706 .release = video_device_release,
1707 .minor = -1,
1708 .vidioc_querycap = vidioc_querycap, 1702 .vidioc_querycap = vidioc_querycap,
1709 .vidioc_enum_input = vidioc_enum_input, 1703 .vidioc_enum_input = vidioc_enum_input,
1710 .vidioc_g_input = vidioc_g_input, 1704 .vidioc_g_input = vidioc_g_input,
@@ -1725,6 +1719,16 @@ static struct video_device meye_template = {
1725 .vidioc_default = vidioc_default, 1719 .vidioc_default = vidioc_default,
1726}; 1720};
1727 1721
1722static struct video_device meye_template = {
1723 .owner = THIS_MODULE,
1724 .name = "meye",
1725 .type = VID_TYPE_CAPTURE,
1726 .fops = &meye_fops,
1727 .ioctl_ops = &meye_ioctl_ops,
1728 .release = video_device_release,
1729 .minor = -1,
1730};
1731
1728#ifdef CONFIG_PM 1732#ifdef CONFIG_PM
1729static int meye_suspend(struct pci_dev *pdev, pm_message_t state) 1733static int meye_suspend(struct pci_dev *pdev, pm_message_t state)
1730{ 1734{
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index eb81915935b1..2428d441fe15 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -1659,12 +1659,7 @@ static const struct file_operations s2255_fops_v4l = {
1659 .llseek = no_llseek, 1659 .llseek = no_llseek,
1660}; 1660};
1661 1661
1662static struct video_device template = { 1662static const struct v4l2_ioctl_ops s2255_ioctl_ops = {
1663 .name = "s2255v",
1664 .type = VID_TYPE_CAPTURE,
1665 .fops = &s2255_fops_v4l,
1666 .minor = -1,
1667 .release = video_device_release,
1668 .vidioc_querycap = vidioc_querycap, 1663 .vidioc_querycap = vidioc_querycap,
1669 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 1664 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
1670 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 1665 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
@@ -1686,6 +1681,15 @@ static struct video_device template = {
1686#ifdef CONFIG_VIDEO_V4L1_COMPAT 1681#ifdef CONFIG_VIDEO_V4L1_COMPAT
1687 .vidiocgmbuf = vidioc_cgmbuf, 1682 .vidiocgmbuf = vidioc_cgmbuf,
1688#endif 1683#endif
1684};
1685
1686static struct video_device template = {
1687 .name = "s2255v",
1688 .type = VID_TYPE_CAPTURE,
1689 .fops = &s2255_fops_v4l,
1690 .ioctl_ops = &s2255_ioctl_ops,
1691 .minor = -1,
1692 .release = video_device_release,
1689 .tvnorms = S2255_NORMS, 1693 .tvnorms = S2255_NORMS,
1690 .current_norm = V4L2_STD_NTSC_M, 1694 .current_norm = V4L2_STD_NTSC_M,
1691}; 1695};
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c
index 3854cc29752d..8b3f95167781 100644
--- a/drivers/media/video/saa7134/saa7134-empress.c
+++ b/drivers/media/video/saa7134/saa7134-empress.c
@@ -400,16 +400,7 @@ static const struct file_operations ts_fops =
400 .llseek = no_llseek, 400 .llseek = no_llseek,
401}; 401};
402 402
403/* ----------------------------------------------------------- */ 403static const struct v4l2_ioctl_ops ts_ioctl_ops = {
404
405static struct video_device saa7134_empress_template =
406{
407 .name = "saa7134-empress",
408 .type = 0 /* FIXME */,
409 .type2 = 0 /* FIXME */,
410 .fops = &ts_fops,
411 .minor = -1,
412
413 .vidioc_querycap = empress_querycap, 404 .vidioc_querycap = empress_querycap,
414 .vidioc_enum_fmt_vid_cap = empress_enum_fmt_vid_cap, 405 .vidioc_enum_fmt_vid_cap = empress_enum_fmt_vid_cap,
415 .vidioc_s_fmt_vid_cap = empress_s_fmt_vid_cap, 406 .vidioc_s_fmt_vid_cap = empress_s_fmt_vid_cap,
@@ -430,6 +421,17 @@ static struct video_device saa7134_empress_template =
430 .vidioc_querymenu = empress_querymenu, 421 .vidioc_querymenu = empress_querymenu,
431 .vidioc_g_ctrl = saa7134_g_ctrl, 422 .vidioc_g_ctrl = saa7134_g_ctrl,
432 .vidioc_s_ctrl = saa7134_s_ctrl, 423 .vidioc_s_ctrl = saa7134_s_ctrl,
424};
425
426/* ----------------------------------------------------------- */
427
428static struct video_device saa7134_empress_template = {
429 .name = "saa7134-empress",
430 .type = 0 /* FIXME */,
431 .type2 = 0 /* FIXME */,
432 .fops = &ts_fops,
433 .minor = -1,
434 .ioctl_ops = &ts_ioctl_ops,
433 435
434 .tvnorms = SAA7134_NORMS, 436 .tvnorms = SAA7134_NORMS,
435 .current_norm = V4L2_STD_PAL, 437 .current_norm = V4L2_STD_PAL,
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 1a5137550e7a..5e9cfc891be8 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -2353,26 +2353,7 @@ static const struct file_operations video_fops =
2353 .llseek = no_llseek, 2353 .llseek = no_llseek,
2354}; 2354};
2355 2355
2356static const struct file_operations radio_fops = 2356static const struct v4l2_ioctl_ops video_ioctl_ops = {
2357{
2358 .owner = THIS_MODULE,
2359 .open = video_open,
2360 .release = video_release,
2361 .ioctl = video_ioctl2,
2362 .compat_ioctl = v4l_compat_ioctl32,
2363 .llseek = no_llseek,
2364};
2365
2366/* ----------------------------------------------------------- */
2367/* exported stuff */
2368
2369struct video_device saa7134_video_template =
2370{
2371 .name = "saa7134-video",
2372 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER |
2373 VID_TYPE_CLIPPING|VID_TYPE_SCALES,
2374 .fops = &video_fops,
2375 .minor = -1,
2376 .vidioc_querycap = saa7134_querycap, 2357 .vidioc_querycap = saa7134_querycap,
2377 .vidioc_enum_fmt_vid_cap = saa7134_enum_fmt_vid_cap, 2358 .vidioc_enum_fmt_vid_cap = saa7134_enum_fmt_vid_cap,
2378 .vidioc_g_fmt_vid_cap = saa7134_g_fmt_vid_cap, 2359 .vidioc_g_fmt_vid_cap = saa7134_g_fmt_vid_cap,
@@ -2421,16 +2402,18 @@ struct video_device saa7134_video_template =
2421 .vidioc_g_register = vidioc_g_register, 2402 .vidioc_g_register = vidioc_g_register,
2422 .vidioc_s_register = vidioc_s_register, 2403 .vidioc_s_register = vidioc_s_register,
2423#endif 2404#endif
2424 .tvnorms = SAA7134_NORMS,
2425 .current_norm = V4L2_STD_PAL,
2426}; 2405};
2427 2406
2428struct video_device saa7134_radio_template = 2407static const struct file_operations radio_fops = {
2429{ 2408 .owner = THIS_MODULE,
2430 .name = "saa7134-radio", 2409 .open = video_open,
2431 .type = VID_TYPE_TUNER, 2410 .release = video_release,
2432 .fops = &radio_fops, 2411 .ioctl = video_ioctl2,
2433 .minor = -1, 2412 .compat_ioctl = v4l_compat_ioctl32,
2413 .llseek = no_llseek,
2414};
2415
2416static const struct v4l2_ioctl_ops radio_ioctl_ops = {
2434 .vidioc_querycap = radio_querycap, 2417 .vidioc_querycap = radio_querycap,
2435 .vidioc_g_tuner = radio_g_tuner, 2418 .vidioc_g_tuner = radio_g_tuner,
2436 .vidioc_enum_input = radio_enum_input, 2419 .vidioc_enum_input = radio_enum_input,
@@ -2447,6 +2430,28 @@ struct video_device saa7134_radio_template =
2447 .vidioc_s_frequency = saa7134_s_frequency, 2430 .vidioc_s_frequency = saa7134_s_frequency,
2448}; 2431};
2449 2432
2433/* ----------------------------------------------------------- */
2434/* exported stuff */
2435
2436struct video_device saa7134_video_template = {
2437 .name = "saa7134-video",
2438 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER |
2439 VID_TYPE_CLIPPING|VID_TYPE_SCALES,
2440 .fops = &video_fops,
2441 .ioctl_ops = &video_ioctl_ops,
2442 .minor = -1,
2443 .tvnorms = SAA7134_NORMS,
2444 .current_norm = V4L2_STD_PAL,
2445};
2446
2447struct video_device saa7134_radio_template = {
2448 .name = "saa7134-radio",
2449 .type = VID_TYPE_TUNER,
2450 .fops = &radio_fops,
2451 .ioctl_ops = &radio_ioctl_ops,
2452 .minor = -1,
2453};
2454
2450int saa7134_video_init1(struct saa7134_dev *dev) 2455int saa7134_video_init1(struct saa7134_dev *dev)
2451{ 2456{
2452 /* sanitycheck insmod options */ 2457 /* sanitycheck insmod options */
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index b01749088472..9ff561452587 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -862,6 +862,35 @@ void soc_camera_device_unregister(struct soc_camera_device *icd)
862} 862}
863EXPORT_SYMBOL(soc_camera_device_unregister); 863EXPORT_SYMBOL(soc_camera_device_unregister);
864 864
865static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = {
866 .vidioc_querycap = soc_camera_querycap,
867 .vidioc_g_fmt_vid_cap = soc_camera_g_fmt_vid_cap,
868 .vidioc_enum_fmt_vid_cap = soc_camera_enum_fmt_vid_cap,
869 .vidioc_s_fmt_vid_cap = soc_camera_s_fmt_vid_cap,
870 .vidioc_enum_input = soc_camera_enum_input,
871 .vidioc_g_input = soc_camera_g_input,
872 .vidioc_s_input = soc_camera_s_input,
873 .vidioc_s_std = soc_camera_s_std,
874 .vidioc_reqbufs = soc_camera_reqbufs,
875 .vidioc_try_fmt_vid_cap = soc_camera_try_fmt_vid_cap,
876 .vidioc_querybuf = soc_camera_querybuf,
877 .vidioc_qbuf = soc_camera_qbuf,
878 .vidioc_dqbuf = soc_camera_dqbuf,
879 .vidioc_streamon = soc_camera_streamon,
880 .vidioc_streamoff = soc_camera_streamoff,
881 .vidioc_queryctrl = soc_camera_queryctrl,
882 .vidioc_g_ctrl = soc_camera_g_ctrl,
883 .vidioc_s_ctrl = soc_camera_s_ctrl,
884 .vidioc_cropcap = soc_camera_cropcap,
885 .vidioc_g_crop = soc_camera_g_crop,
886 .vidioc_s_crop = soc_camera_s_crop,
887 .vidioc_g_chip_ident = soc_camera_g_chip_ident,
888#ifdef CONFIG_VIDEO_ADV_DEBUG
889 .vidioc_g_register = soc_camera_g_register,
890 .vidioc_s_register = soc_camera_s_register,
891#endif
892};
893
865int soc_camera_video_start(struct soc_camera_device *icd) 894int soc_camera_video_start(struct soc_camera_device *icd)
866{ 895{
867 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); 896 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
@@ -882,35 +911,10 @@ int soc_camera_video_start(struct soc_camera_device *icd)
882 vdev->type = VID_TYPE_CAPTURE; 911 vdev->type = VID_TYPE_CAPTURE;
883 vdev->current_norm = V4L2_STD_UNKNOWN; 912 vdev->current_norm = V4L2_STD_UNKNOWN;
884 vdev->fops = &soc_camera_fops; 913 vdev->fops = &soc_camera_fops;
914 vdev->ioctl_ops = &soc_camera_ioctl_ops;
885 vdev->release = video_device_release; 915 vdev->release = video_device_release;
886 vdev->minor = -1; 916 vdev->minor = -1;
887 vdev->tvnorms = V4L2_STD_UNKNOWN, 917 vdev->tvnorms = V4L2_STD_UNKNOWN,
888 vdev->vidioc_querycap = soc_camera_querycap;
889 vdev->vidioc_g_fmt_vid_cap = soc_camera_g_fmt_vid_cap;
890 vdev->vidioc_enum_fmt_vid_cap = soc_camera_enum_fmt_vid_cap;
891 vdev->vidioc_s_fmt_vid_cap = soc_camera_s_fmt_vid_cap;
892 vdev->vidioc_enum_input = soc_camera_enum_input;
893 vdev->vidioc_g_input = soc_camera_g_input;
894 vdev->vidioc_s_input = soc_camera_s_input;
895 vdev->vidioc_s_std = soc_camera_s_std;
896 vdev->vidioc_reqbufs = soc_camera_reqbufs;
897 vdev->vidioc_try_fmt_vid_cap = soc_camera_try_fmt_vid_cap;
898 vdev->vidioc_querybuf = soc_camera_querybuf;
899 vdev->vidioc_qbuf = soc_camera_qbuf;
900 vdev->vidioc_dqbuf = soc_camera_dqbuf;
901 vdev->vidioc_streamon = soc_camera_streamon;
902 vdev->vidioc_streamoff = soc_camera_streamoff;
903 vdev->vidioc_queryctrl = soc_camera_queryctrl;
904 vdev->vidioc_g_ctrl = soc_camera_g_ctrl;
905 vdev->vidioc_s_ctrl = soc_camera_s_ctrl;
906 vdev->vidioc_cropcap = soc_camera_cropcap;
907 vdev->vidioc_g_crop = soc_camera_g_crop;
908 vdev->vidioc_s_crop = soc_camera_s_crop;
909 vdev->vidioc_g_chip_ident = soc_camera_g_chip_ident;
910#ifdef CONFIG_VIDEO_ADV_DEBUG
911 vdev->vidioc_g_register = soc_camera_g_register;
912 vdev->vidioc_s_register = soc_camera_s_register;
913#endif
914 918
915 icd->current_fmt = &icd->formats[0]; 919 icd->current_fmt = &icd->formats[0];
916 920
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c
index 20028aeb842b..8d5fa95ad95a 100644
--- a/drivers/media/video/stk-webcam.c
+++ b/drivers/media/video/stk-webcam.c
@@ -1328,20 +1328,7 @@ static struct file_operations v4l_stk_fops = {
1328 .llseek = no_llseek 1328 .llseek = no_llseek
1329}; 1329};
1330 1330
1331static void stk_v4l_dev_release(struct video_device *vd) 1331static const struct v4l2_ioctl_ops v4l_stk_ioctl_ops = {
1332{
1333}
1334
1335static struct video_device stk_v4l_data = {
1336 .name = "stkwebcam",
1337 .type = VFL_TYPE_GRABBER,
1338 .type2 = VID_TYPE_CAPTURE,
1339 .minor = -1,
1340 .tvnorms = V4L2_STD_UNKNOWN,
1341 .current_norm = V4L2_STD_UNKNOWN,
1342 .fops = &v4l_stk_fops,
1343 .release = stk_v4l_dev_release,
1344
1345 .vidioc_querycap = stk_vidioc_querycap, 1332 .vidioc_querycap = stk_vidioc_querycap,
1346 .vidioc_enum_fmt_vid_cap = stk_vidioc_enum_fmt_vid_cap, 1333 .vidioc_enum_fmt_vid_cap = stk_vidioc_enum_fmt_vid_cap,
1347 .vidioc_try_fmt_vid_cap = stk_vidioc_try_fmt_vid_cap, 1334 .vidioc_try_fmt_vid_cap = stk_vidioc_try_fmt_vid_cap,
@@ -1363,6 +1350,22 @@ static struct video_device stk_v4l_data = {
1363 .vidioc_g_parm = stk_vidioc_g_parm, 1350 .vidioc_g_parm = stk_vidioc_g_parm,
1364}; 1351};
1365 1352
1353static void stk_v4l_dev_release(struct video_device *vd)
1354{
1355}
1356
1357static struct video_device stk_v4l_data = {
1358 .name = "stkwebcam",
1359 .type = VFL_TYPE_GRABBER,
1360 .type2 = VID_TYPE_CAPTURE,
1361 .minor = -1,
1362 .tvnorms = V4L2_STD_UNKNOWN,
1363 .current_norm = V4L2_STD_UNKNOWN,
1364 .fops = &v4l_stk_fops,
1365 .ioctl_ops = &v4l_stk_ioctl_ops,
1366 .release = stk_v4l_dev_release,
1367};
1368
1366 1369
1367static int stk_register_video_device(struct stk_camera *dev) 1370static int stk_register_video_device(struct stk_camera *dev)
1368{ 1371{
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c
index 5984c7562035..7eccdc1ea2d7 100644
--- a/drivers/media/video/usbvision/usbvision-video.c
+++ b/drivers/media/video/usbvision/usbvision-video.c
@@ -1370,13 +1370,8 @@ static const struct file_operations usbvision_fops = {
1370/* .poll = video_poll, */ 1370/* .poll = video_poll, */
1371 .compat_ioctl = v4l_compat_ioctl32, 1371 .compat_ioctl = v4l_compat_ioctl32,
1372}; 1372};
1373static struct video_device usbvision_video_template = { 1373
1374 .owner = THIS_MODULE, 1374static const struct v4l2_ioctl_ops usbvision_ioctl_ops = {
1375 .type = VID_TYPE_TUNER | VID_TYPE_CAPTURE,
1376 .fops = &usbvision_fops,
1377 .name = "usbvision-video",
1378 .release = video_device_release,
1379 .minor = -1,
1380 .vidioc_querycap = vidioc_querycap, 1375 .vidioc_querycap = vidioc_querycap,
1381 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 1376 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
1382 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 1377 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
@@ -1408,6 +1403,16 @@ static struct video_device usbvision_video_template = {
1408 .vidioc_g_register = vidioc_g_register, 1403 .vidioc_g_register = vidioc_g_register,
1409 .vidioc_s_register = vidioc_s_register, 1404 .vidioc_s_register = vidioc_s_register,
1410#endif 1405#endif
1406};
1407
1408static struct video_device usbvision_video_template = {
1409 .owner = THIS_MODULE,
1410 .type = VID_TYPE_TUNER | VID_TYPE_CAPTURE,
1411 .fops = &usbvision_fops,
1412 .ioctl_ops = &usbvision_ioctl_ops,
1413 .name = "usbvision-video",
1414 .release = video_device_release,
1415 .minor = -1,
1411 .tvnorms = USBVISION_NORMS, 1416 .tvnorms = USBVISION_NORMS,
1412 .current_norm = V4L2_STD_PAL 1417 .current_norm = V4L2_STD_PAL
1413}; 1418};
@@ -1423,14 +1428,7 @@ static const struct file_operations usbvision_radio_fops = {
1423 .compat_ioctl = v4l_compat_ioctl32, 1428 .compat_ioctl = v4l_compat_ioctl32,
1424}; 1429};
1425 1430
1426static struct video_device usbvision_radio_template= 1431static const struct v4l2_ioctl_ops usbvision_radio_ioctl_ops = {
1427{
1428 .owner = THIS_MODULE,
1429 .type = VID_TYPE_TUNER,
1430 .fops = &usbvision_radio_fops,
1431 .name = "usbvision-radio",
1432 .release = video_device_release,
1433 .minor = -1,
1434 .vidioc_querycap = vidioc_querycap, 1432 .vidioc_querycap = vidioc_querycap,
1435 .vidioc_enum_input = vidioc_enum_input, 1433 .vidioc_enum_input = vidioc_enum_input,
1436 .vidioc_g_input = vidioc_g_input, 1434 .vidioc_g_input = vidioc_g_input,
@@ -1444,6 +1442,16 @@ static struct video_device usbvision_radio_template=
1444 .vidioc_s_tuner = vidioc_s_tuner, 1442 .vidioc_s_tuner = vidioc_s_tuner,
1445 .vidioc_g_frequency = vidioc_g_frequency, 1443 .vidioc_g_frequency = vidioc_g_frequency,
1446 .vidioc_s_frequency = vidioc_s_frequency, 1444 .vidioc_s_frequency = vidioc_s_frequency,
1445};
1446
1447static struct video_device usbvision_radio_template = {
1448 .owner = THIS_MODULE,
1449 .type = VID_TYPE_TUNER,
1450 .fops = &usbvision_radio_fops,
1451 .name = "usbvision-radio",
1452 .release = video_device_release,
1453 .minor = -1,
1454 .ioctl_ops = &usbvision_radio_ioctl_ops,
1447 1455
1448 .tvnorms = USBVISION_NORMS, 1456 .tvnorms = USBVISION_NORMS,
1449 .current_norm = V4L2_STD_PAL 1457 .current_norm = V4L2_STD_PAL
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 56a4fdee9160..fdfe7739c96e 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -579,43 +579,46 @@ static inline int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv)
579 return 1; 579 return 1;
580} 580}
581 581
582static int check_fmt(struct video_device *vfd, enum v4l2_buf_type type) 582static int check_fmt(const struct v4l2_ioctl_ops *ops, enum v4l2_buf_type type)
583{ 583{
584 if (ops == NULL)
585 return -EINVAL;
586
584 switch (type) { 587 switch (type) {
585 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 588 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
586 if (vfd->vidioc_try_fmt_vid_cap) 589 if (ops->vidioc_try_fmt_vid_cap)
587 return 0; 590 return 0;
588 break; 591 break;
589 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 592 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
590 if (vfd->vidioc_try_fmt_vid_overlay) 593 if (ops->vidioc_try_fmt_vid_overlay)
591 return 0; 594 return 0;
592 break; 595 break;
593 case V4L2_BUF_TYPE_VIDEO_OUTPUT: 596 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
594 if (vfd->vidioc_try_fmt_vid_out) 597 if (ops->vidioc_try_fmt_vid_out)
595 return 0; 598 return 0;
596 break; 599 break;
597 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: 600 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
598 if (vfd->vidioc_try_fmt_vid_out_overlay) 601 if (ops->vidioc_try_fmt_vid_out_overlay)
599 return 0; 602 return 0;
600 break; 603 break;
601 case V4L2_BUF_TYPE_VBI_CAPTURE: 604 case V4L2_BUF_TYPE_VBI_CAPTURE:
602 if (vfd->vidioc_try_fmt_vbi_cap) 605 if (ops->vidioc_try_fmt_vbi_cap)
603 return 0; 606 return 0;
604 break; 607 break;
605 case V4L2_BUF_TYPE_VBI_OUTPUT: 608 case V4L2_BUF_TYPE_VBI_OUTPUT:
606 if (vfd->vidioc_try_fmt_vbi_out) 609 if (ops->vidioc_try_fmt_vbi_out)
607 return 0; 610 return 0;
608 break; 611 break;
609 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: 612 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
610 if (vfd->vidioc_try_fmt_sliced_vbi_cap) 613 if (ops->vidioc_try_fmt_sliced_vbi_cap)
611 return 0; 614 return 0;
612 break; 615 break;
613 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: 616 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
614 if (vfd->vidioc_try_fmt_sliced_vbi_out) 617 if (ops->vidioc_try_fmt_sliced_vbi_out)
615 return 0; 618 return 0;
616 break; 619 break;
617 case V4L2_BUF_TYPE_PRIVATE: 620 case V4L2_BUF_TYPE_PRIVATE:
618 if (vfd->vidioc_try_fmt_type_private) 621 if (ops->vidioc_try_fmt_type_private)
619 return 0; 622 return 0;
620 break; 623 break;
621 } 624 }
@@ -626,6 +629,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
626 unsigned int cmd, void *arg) 629 unsigned int cmd, void *arg)
627{ 630{
628 struct video_device *vfd = video_devdata(file); 631 struct video_device *vfd = video_devdata(file);
632 const struct v4l2_ioctl_ops *ops = vfd->ioctl_ops;
629 void *fh = file->private_data; 633 void *fh = file->private_data;
630 int ret = -EINVAL; 634 int ret = -EINVAL;
631 635
@@ -635,6 +639,12 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
635 printk(KERN_CONT "\n"); 639 printk(KERN_CONT "\n");
636 } 640 }
637 641
642 if (ops == NULL) {
643 printk(KERN_WARNING "videodev: \"%s\" has no ioctl_ops.\n",
644 vfd->name);
645 return -EINVAL;
646 }
647
638#ifdef CONFIG_VIDEO_V4L1_COMPAT 648#ifdef CONFIG_VIDEO_V4L1_COMPAT
639 /*********************************************************** 649 /***********************************************************
640 Handles calls to the obsoleted V4L1 API 650 Handles calls to the obsoleted V4L1 API
@@ -648,9 +658,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
648 658
649 memset(p, 0, sizeof(*p)); 659 memset(p, 0, sizeof(*p));
650 660
651 if (!vfd->vidiocgmbuf) 661 if (!ops->vidiocgmbuf)
652 return ret; 662 return ret;
653 ret = vfd->vidiocgmbuf(file, fh, p); 663 ret = ops->vidiocgmbuf(file, fh, p);
654 if (!ret) 664 if (!ret)
655 dbgarg(cmd, "size=%d, frames=%d, offsets=0x%08lx\n", 665 dbgarg(cmd, "size=%d, frames=%d, offsets=0x%08lx\n",
656 p->size, p->frames, 666 p->size, p->frames,
@@ -676,10 +686,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
676 struct v4l2_capability *cap = (struct v4l2_capability *)arg; 686 struct v4l2_capability *cap = (struct v4l2_capability *)arg;
677 memset(cap, 0, sizeof(*cap)); 687 memset(cap, 0, sizeof(*cap));
678 688
679 if (!vfd->vidioc_querycap) 689 if (!ops->vidioc_querycap)
680 break; 690 break;
681 691
682 ret = vfd->vidioc_querycap(file, fh, cap); 692 ret = ops->vidioc_querycap(file, fh, cap);
683 if (!ret) 693 if (!ret)
684 dbgarg(cmd, "driver=%s, card=%s, bus=%s, " 694 dbgarg(cmd, "driver=%s, card=%s, bus=%s, "
685 "version=0x%08x, " 695 "version=0x%08x, "
@@ -695,9 +705,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
695 { 705 {
696 enum v4l2_priority *p = arg; 706 enum v4l2_priority *p = arg;
697 707
698 if (!vfd->vidioc_g_priority) 708 if (!ops->vidioc_g_priority)
699 break; 709 break;
700 ret = vfd->vidioc_g_priority(file, fh, p); 710 ret = ops->vidioc_g_priority(file, fh, p);
701 if (!ret) 711 if (!ret)
702 dbgarg(cmd, "priority is %d\n", *p); 712 dbgarg(cmd, "priority is %d\n", *p);
703 break; 713 break;
@@ -706,10 +716,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
706 { 716 {
707 enum v4l2_priority *p = arg; 717 enum v4l2_priority *p = arg;
708 718
709 if (!vfd->vidioc_s_priority) 719 if (!ops->vidioc_s_priority)
710 break; 720 break;
711 dbgarg(cmd, "setting priority to %d\n", *p); 721 dbgarg(cmd, "setting priority to %d\n", *p);
712 ret = vfd->vidioc_s_priority(file, fh, *p); 722 ret = ops->vidioc_s_priority(file, fh, *p);
713 break; 723 break;
714 } 724 }
715 725
@@ -728,12 +738,12 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
728 738
729 switch (type) { 739 switch (type) {
730 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 740 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
731 if (vfd->vidioc_enum_fmt_vid_cap) 741 if (ops->vidioc_enum_fmt_vid_cap)
732 ret = vfd->vidioc_enum_fmt_vid_cap(file, fh, f); 742 ret = ops->vidioc_enum_fmt_vid_cap(file, fh, f);
733 break; 743 break;
734 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 744 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
735 if (vfd->vidioc_enum_fmt_vid_overlay) 745 if (ops->vidioc_enum_fmt_vid_overlay)
736 ret = vfd->vidioc_enum_fmt_vid_overlay(file, 746 ret = ops->vidioc_enum_fmt_vid_overlay(file,
737 fh, f); 747 fh, f);
738 break; 748 break;
739#if 1 749#if 1
@@ -742,19 +752,19 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
742 * it though, so just warn that this is deprecated and will be 752 * it though, so just warn that this is deprecated and will be
743 * removed in the near future. */ 753 * removed in the near future. */
744 case V4L2_BUF_TYPE_VBI_CAPTURE: 754 case V4L2_BUF_TYPE_VBI_CAPTURE:
745 if (vfd->vidioc_enum_fmt_vbi_cap) { 755 if (ops->vidioc_enum_fmt_vbi_cap) {
746 printk(KERN_WARNING "vidioc_enum_fmt_vbi_cap will be removed in 2.6.28!\n"); 756 printk(KERN_WARNING "vidioc_enum_fmt_vbi_cap will be removed in 2.6.28!\n");
747 ret = vfd->vidioc_enum_fmt_vbi_cap(file, fh, f); 757 ret = ops->vidioc_enum_fmt_vbi_cap(file, fh, f);
748 } 758 }
749 break; 759 break;
750#endif 760#endif
751 case V4L2_BUF_TYPE_VIDEO_OUTPUT: 761 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
752 if (vfd->vidioc_enum_fmt_vid_out) 762 if (ops->vidioc_enum_fmt_vid_out)
753 ret = vfd->vidioc_enum_fmt_vid_out(file, fh, f); 763 ret = ops->vidioc_enum_fmt_vid_out(file, fh, f);
754 break; 764 break;
755 case V4L2_BUF_TYPE_PRIVATE: 765 case V4L2_BUF_TYPE_PRIVATE:
756 if (vfd->vidioc_enum_fmt_type_private) 766 if (ops->vidioc_enum_fmt_type_private)
757 ret = vfd->vidioc_enum_fmt_type_private(file, 767 ret = ops->vidioc_enum_fmt_type_private(file,
758 fh, f); 768 fh, f);
759 break; 769 break;
760 default: 770 default:
@@ -782,48 +792,48 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
782 792
783 switch (f->type) { 793 switch (f->type) {
784 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 794 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
785 if (vfd->vidioc_g_fmt_vid_cap) 795 if (ops->vidioc_g_fmt_vid_cap)
786 ret = vfd->vidioc_g_fmt_vid_cap(file, fh, f); 796 ret = ops->vidioc_g_fmt_vid_cap(file, fh, f);
787 if (!ret) 797 if (!ret)
788 v4l_print_pix_fmt(vfd, &f->fmt.pix); 798 v4l_print_pix_fmt(vfd, &f->fmt.pix);
789 break; 799 break;
790 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 800 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
791 if (vfd->vidioc_g_fmt_vid_overlay) 801 if (ops->vidioc_g_fmt_vid_overlay)
792 ret = vfd->vidioc_g_fmt_vid_overlay(file, 802 ret = ops->vidioc_g_fmt_vid_overlay(file,
793 fh, f); 803 fh, f);
794 break; 804 break;
795 case V4L2_BUF_TYPE_VIDEO_OUTPUT: 805 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
796 if (vfd->vidioc_g_fmt_vid_out) 806 if (ops->vidioc_g_fmt_vid_out)
797 ret = vfd->vidioc_g_fmt_vid_out(file, fh, f); 807 ret = ops->vidioc_g_fmt_vid_out(file, fh, f);
798 if (!ret) 808 if (!ret)
799 v4l_print_pix_fmt(vfd, &f->fmt.pix); 809 v4l_print_pix_fmt(vfd, &f->fmt.pix);
800 break; 810 break;
801 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: 811 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
802 if (vfd->vidioc_g_fmt_vid_out_overlay) 812 if (ops->vidioc_g_fmt_vid_out_overlay)
803 ret = vfd->vidioc_g_fmt_vid_out_overlay(file, 813 ret = ops->vidioc_g_fmt_vid_out_overlay(file,
804 fh, f); 814 fh, f);
805 break; 815 break;
806 case V4L2_BUF_TYPE_VBI_CAPTURE: 816 case V4L2_BUF_TYPE_VBI_CAPTURE:
807 if (vfd->vidioc_g_fmt_vbi_cap) 817 if (ops->vidioc_g_fmt_vbi_cap)
808 ret = vfd->vidioc_g_fmt_vbi_cap(file, fh, f); 818 ret = ops->vidioc_g_fmt_vbi_cap(file, fh, f);
809 break; 819 break;
810 case V4L2_BUF_TYPE_VBI_OUTPUT: 820 case V4L2_BUF_TYPE_VBI_OUTPUT:
811 if (vfd->vidioc_g_fmt_vbi_out) 821 if (ops->vidioc_g_fmt_vbi_out)
812 ret = vfd->vidioc_g_fmt_vbi_out(file, fh, f); 822 ret = ops->vidioc_g_fmt_vbi_out(file, fh, f);
813 break; 823 break;
814 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: 824 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
815 if (vfd->vidioc_g_fmt_sliced_vbi_cap) 825 if (ops->vidioc_g_fmt_sliced_vbi_cap)
816 ret = vfd->vidioc_g_fmt_sliced_vbi_cap(file, 826 ret = ops->vidioc_g_fmt_sliced_vbi_cap(file,
817 fh, f); 827 fh, f);
818 break; 828 break;
819 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: 829 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
820 if (vfd->vidioc_g_fmt_sliced_vbi_out) 830 if (ops->vidioc_g_fmt_sliced_vbi_out)
821 ret = vfd->vidioc_g_fmt_sliced_vbi_out(file, 831 ret = ops->vidioc_g_fmt_sliced_vbi_out(file,
822 fh, f); 832 fh, f);
823 break; 833 break;
824 case V4L2_BUF_TYPE_PRIVATE: 834 case V4L2_BUF_TYPE_PRIVATE:
825 if (vfd->vidioc_g_fmt_type_private) 835 if (ops->vidioc_g_fmt_type_private)
826 ret = vfd->vidioc_g_fmt_type_private(file, 836 ret = ops->vidioc_g_fmt_type_private(file,
827 fh, f); 837 fh, f);
828 break; 838 break;
829 } 839 }
@@ -840,45 +850,45 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
840 switch (f->type) { 850 switch (f->type) {
841 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 851 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
842 v4l_print_pix_fmt(vfd, &f->fmt.pix); 852 v4l_print_pix_fmt(vfd, &f->fmt.pix);
843 if (vfd->vidioc_s_fmt_vid_cap) 853 if (ops->vidioc_s_fmt_vid_cap)
844 ret = vfd->vidioc_s_fmt_vid_cap(file, fh, f); 854 ret = ops->vidioc_s_fmt_vid_cap(file, fh, f);
845 break; 855 break;
846 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 856 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
847 if (vfd->vidioc_s_fmt_vid_overlay) 857 if (ops->vidioc_s_fmt_vid_overlay)
848 ret = vfd->vidioc_s_fmt_vid_overlay(file, 858 ret = ops->vidioc_s_fmt_vid_overlay(file,
849 fh, f); 859 fh, f);
850 break; 860 break;
851 case V4L2_BUF_TYPE_VIDEO_OUTPUT: 861 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
852 v4l_print_pix_fmt(vfd, &f->fmt.pix); 862 v4l_print_pix_fmt(vfd, &f->fmt.pix);
853 if (vfd->vidioc_s_fmt_vid_out) 863 if (ops->vidioc_s_fmt_vid_out)
854 ret = vfd->vidioc_s_fmt_vid_out(file, fh, f); 864 ret = ops->vidioc_s_fmt_vid_out(file, fh, f);
855 break; 865 break;
856 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: 866 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
857 if (vfd->vidioc_s_fmt_vid_out_overlay) 867 if (ops->vidioc_s_fmt_vid_out_overlay)
858 ret = vfd->vidioc_s_fmt_vid_out_overlay(file, 868 ret = ops->vidioc_s_fmt_vid_out_overlay(file,
859 fh, f); 869 fh, f);
860 break; 870 break;
861 case V4L2_BUF_TYPE_VBI_CAPTURE: 871 case V4L2_BUF_TYPE_VBI_CAPTURE:
862 if (vfd->vidioc_s_fmt_vbi_cap) 872 if (ops->vidioc_s_fmt_vbi_cap)
863 ret = vfd->vidioc_s_fmt_vbi_cap(file, fh, f); 873 ret = ops->vidioc_s_fmt_vbi_cap(file, fh, f);
864 break; 874 break;
865 case V4L2_BUF_TYPE_VBI_OUTPUT: 875 case V4L2_BUF_TYPE_VBI_OUTPUT:
866 if (vfd->vidioc_s_fmt_vbi_out) 876 if (ops->vidioc_s_fmt_vbi_out)
867 ret = vfd->vidioc_s_fmt_vbi_out(file, fh, f); 877 ret = ops->vidioc_s_fmt_vbi_out(file, fh, f);
868 break; 878 break;
869 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: 879 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
870 if (vfd->vidioc_s_fmt_sliced_vbi_cap) 880 if (ops->vidioc_s_fmt_sliced_vbi_cap)
871 ret = vfd->vidioc_s_fmt_sliced_vbi_cap(file, 881 ret = ops->vidioc_s_fmt_sliced_vbi_cap(file,
872 fh, f); 882 fh, f);
873 break; 883 break;
874 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: 884 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
875 if (vfd->vidioc_s_fmt_sliced_vbi_out) 885 if (ops->vidioc_s_fmt_sliced_vbi_out)
876 ret = vfd->vidioc_s_fmt_sliced_vbi_out(file, 886 ret = ops->vidioc_s_fmt_sliced_vbi_out(file,
877 fh, f); 887 fh, f);
878 break; 888 break;
879 case V4L2_BUF_TYPE_PRIVATE: 889 case V4L2_BUF_TYPE_PRIVATE:
880 if (vfd->vidioc_s_fmt_type_private) 890 if (ops->vidioc_s_fmt_type_private)
881 ret = vfd->vidioc_s_fmt_type_private(file, 891 ret = ops->vidioc_s_fmt_type_private(file,
882 fh, f); 892 fh, f);
883 break; 893 break;
884 } 894 }
@@ -893,48 +903,48 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
893 v4l2_type_names)); 903 v4l2_type_names));
894 switch (f->type) { 904 switch (f->type) {
895 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 905 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
896 if (vfd->vidioc_try_fmt_vid_cap) 906 if (ops->vidioc_try_fmt_vid_cap)
897 ret = vfd->vidioc_try_fmt_vid_cap(file, fh, f); 907 ret = ops->vidioc_try_fmt_vid_cap(file, fh, f);
898 if (!ret) 908 if (!ret)
899 v4l_print_pix_fmt(vfd, &f->fmt.pix); 909 v4l_print_pix_fmt(vfd, &f->fmt.pix);
900 break; 910 break;
901 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 911 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
902 if (vfd->vidioc_try_fmt_vid_overlay) 912 if (ops->vidioc_try_fmt_vid_overlay)
903 ret = vfd->vidioc_try_fmt_vid_overlay(file, 913 ret = ops->vidioc_try_fmt_vid_overlay(file,
904 fh, f); 914 fh, f);
905 break; 915 break;
906 case V4L2_BUF_TYPE_VIDEO_OUTPUT: 916 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
907 if (vfd->vidioc_try_fmt_vid_out) 917 if (ops->vidioc_try_fmt_vid_out)
908 ret = vfd->vidioc_try_fmt_vid_out(file, fh, f); 918 ret = ops->vidioc_try_fmt_vid_out(file, fh, f);
909 if (!ret) 919 if (!ret)
910 v4l_print_pix_fmt(vfd, &f->fmt.pix); 920 v4l_print_pix_fmt(vfd, &f->fmt.pix);
911 break; 921 break;
912 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: 922 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
913 if (vfd->vidioc_try_fmt_vid_out_overlay) 923 if (ops->vidioc_try_fmt_vid_out_overlay)
914 ret = vfd->vidioc_try_fmt_vid_out_overlay(file, 924 ret = ops->vidioc_try_fmt_vid_out_overlay(file,
915 fh, f); 925 fh, f);
916 break; 926 break;
917 case V4L2_BUF_TYPE_VBI_CAPTURE: 927 case V4L2_BUF_TYPE_VBI_CAPTURE:
918 if (vfd->vidioc_try_fmt_vbi_cap) 928 if (ops->vidioc_try_fmt_vbi_cap)
919 ret = vfd->vidioc_try_fmt_vbi_cap(file, fh, f); 929 ret = ops->vidioc_try_fmt_vbi_cap(file, fh, f);
920 break; 930 break;
921 case V4L2_BUF_TYPE_VBI_OUTPUT: 931 case V4L2_BUF_TYPE_VBI_OUTPUT:
922 if (vfd->vidioc_try_fmt_vbi_out) 932 if (ops->vidioc_try_fmt_vbi_out)
923 ret = vfd->vidioc_try_fmt_vbi_out(file, fh, f); 933 ret = ops->vidioc_try_fmt_vbi_out(file, fh, f);
924 break; 934 break;
925 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: 935 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
926 if (vfd->vidioc_try_fmt_sliced_vbi_cap) 936 if (ops->vidioc_try_fmt_sliced_vbi_cap)
927 ret = vfd->vidioc_try_fmt_sliced_vbi_cap(file, 937 ret = ops->vidioc_try_fmt_sliced_vbi_cap(file,
928 fh, f); 938 fh, f);
929 break; 939 break;
930 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: 940 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
931 if (vfd->vidioc_try_fmt_sliced_vbi_out) 941 if (ops->vidioc_try_fmt_sliced_vbi_out)
932 ret = vfd->vidioc_try_fmt_sliced_vbi_out(file, 942 ret = ops->vidioc_try_fmt_sliced_vbi_out(file,
933 fh, f); 943 fh, f);
934 break; 944 break;
935 case V4L2_BUF_TYPE_PRIVATE: 945 case V4L2_BUF_TYPE_PRIVATE:
936 if (vfd->vidioc_try_fmt_type_private) 946 if (ops->vidioc_try_fmt_type_private)
937 ret = vfd->vidioc_try_fmt_type_private(file, 947 ret = ops->vidioc_try_fmt_type_private(file,
938 fh, f); 948 fh, f);
939 break; 949 break;
940 } 950 }
@@ -949,13 +959,13 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
949 { 959 {
950 struct v4l2_requestbuffers *p = arg; 960 struct v4l2_requestbuffers *p = arg;
951 961
952 if (!vfd->vidioc_reqbufs) 962 if (!ops->vidioc_reqbufs)
953 break; 963 break;
954 ret = check_fmt(vfd, p->type); 964 ret = check_fmt(ops, p->type);
955 if (ret) 965 if (ret)
956 break; 966 break;
957 967
958 ret = vfd->vidioc_reqbufs(file, fh, p); 968 ret = ops->vidioc_reqbufs(file, fh, p);
959 dbgarg(cmd, "count=%d, type=%s, memory=%s\n", 969 dbgarg(cmd, "count=%d, type=%s, memory=%s\n",
960 p->count, 970 p->count,
961 prt_names(p->type, v4l2_type_names), 971 prt_names(p->type, v4l2_type_names),
@@ -966,13 +976,13 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
966 { 976 {
967 struct v4l2_buffer *p = arg; 977 struct v4l2_buffer *p = arg;
968 978
969 if (!vfd->vidioc_querybuf) 979 if (!ops->vidioc_querybuf)
970 break; 980 break;
971 ret = check_fmt(vfd, p->type); 981 ret = check_fmt(ops, p->type);
972 if (ret) 982 if (ret)
973 break; 983 break;
974 984
975 ret = vfd->vidioc_querybuf(file, fh, p); 985 ret = ops->vidioc_querybuf(file, fh, p);
976 if (!ret) 986 if (!ret)
977 dbgbuf(cmd, vfd, p); 987 dbgbuf(cmd, vfd, p);
978 break; 988 break;
@@ -981,13 +991,13 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
981 { 991 {
982 struct v4l2_buffer *p = arg; 992 struct v4l2_buffer *p = arg;
983 993
984 if (!vfd->vidioc_qbuf) 994 if (!ops->vidioc_qbuf)
985 break; 995 break;
986 ret = check_fmt(vfd, p->type); 996 ret = check_fmt(ops, p->type);
987 if (ret) 997 if (ret)
988 break; 998 break;
989 999
990 ret = vfd->vidioc_qbuf(file, fh, p); 1000 ret = ops->vidioc_qbuf(file, fh, p);
991 if (!ret) 1001 if (!ret)
992 dbgbuf(cmd, vfd, p); 1002 dbgbuf(cmd, vfd, p);
993 break; 1003 break;
@@ -996,13 +1006,13 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
996 { 1006 {
997 struct v4l2_buffer *p = arg; 1007 struct v4l2_buffer *p = arg;
998 1008
999 if (!vfd->vidioc_dqbuf) 1009 if (!ops->vidioc_dqbuf)
1000 break; 1010 break;
1001 ret = check_fmt(vfd, p->type); 1011 ret = check_fmt(ops, p->type);
1002 if (ret) 1012 if (ret)
1003 break; 1013 break;
1004 1014
1005 ret = vfd->vidioc_dqbuf(file, fh, p); 1015 ret = ops->vidioc_dqbuf(file, fh, p);
1006 if (!ret) 1016 if (!ret)
1007 dbgbuf(cmd, vfd, p); 1017 dbgbuf(cmd, vfd, p);
1008 break; 1018 break;
@@ -1011,19 +1021,19 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1011 { 1021 {
1012 int *i = arg; 1022 int *i = arg;
1013 1023
1014 if (!vfd->vidioc_overlay) 1024 if (!ops->vidioc_overlay)
1015 break; 1025 break;
1016 dbgarg(cmd, "value=%d\n", *i); 1026 dbgarg(cmd, "value=%d\n", *i);
1017 ret = vfd->vidioc_overlay(file, fh, *i); 1027 ret = ops->vidioc_overlay(file, fh, *i);
1018 break; 1028 break;
1019 } 1029 }
1020 case VIDIOC_G_FBUF: 1030 case VIDIOC_G_FBUF:
1021 { 1031 {
1022 struct v4l2_framebuffer *p = arg; 1032 struct v4l2_framebuffer *p = arg;
1023 1033
1024 if (!vfd->vidioc_g_fbuf) 1034 if (!ops->vidioc_g_fbuf)
1025 break; 1035 break;
1026 ret = vfd->vidioc_g_fbuf(file, fh, arg); 1036 ret = ops->vidioc_g_fbuf(file, fh, arg);
1027 if (!ret) { 1037 if (!ret) {
1028 dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n", 1038 dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n",
1029 p->capability, p->flags, 1039 p->capability, p->flags,
@@ -1036,32 +1046,32 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1036 { 1046 {
1037 struct v4l2_framebuffer *p = arg; 1047 struct v4l2_framebuffer *p = arg;
1038 1048
1039 if (!vfd->vidioc_s_fbuf) 1049 if (!ops->vidioc_s_fbuf)
1040 break; 1050 break;
1041 dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n", 1051 dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n",
1042 p->capability, p->flags, (unsigned long)p->base); 1052 p->capability, p->flags, (unsigned long)p->base);
1043 v4l_print_pix_fmt(vfd, &p->fmt); 1053 v4l_print_pix_fmt(vfd, &p->fmt);
1044 ret = vfd->vidioc_s_fbuf(file, fh, arg); 1054 ret = ops->vidioc_s_fbuf(file, fh, arg);
1045 break; 1055 break;
1046 } 1056 }
1047 case VIDIOC_STREAMON: 1057 case VIDIOC_STREAMON:
1048 { 1058 {
1049 enum v4l2_buf_type i = *(int *)arg; 1059 enum v4l2_buf_type i = *(int *)arg;
1050 1060
1051 if (!vfd->vidioc_streamon) 1061 if (!ops->vidioc_streamon)
1052 break; 1062 break;
1053 dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names)); 1063 dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names));
1054 ret = vfd->vidioc_streamon(file, fh, i); 1064 ret = ops->vidioc_streamon(file, fh, i);
1055 break; 1065 break;
1056 } 1066 }
1057 case VIDIOC_STREAMOFF: 1067 case VIDIOC_STREAMOFF:
1058 { 1068 {
1059 enum v4l2_buf_type i = *(int *)arg; 1069 enum v4l2_buf_type i = *(int *)arg;
1060 1070
1061 if (!vfd->vidioc_streamoff) 1071 if (!ops->vidioc_streamoff)
1062 break; 1072 break;
1063 dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names)); 1073 dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names));
1064 ret = vfd->vidioc_streamoff(file, fh, i); 1074 ret = ops->vidioc_streamoff(file, fh, i);
1065 break; 1075 break;
1066 } 1076 }
1067 /* ---------- tv norms ---------- */ 1077 /* ---------- tv norms ---------- */
@@ -1110,8 +1120,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1110 1120
1111 ret = 0; 1121 ret = 0;
1112 /* Calls the specific handler */ 1122 /* Calls the specific handler */
1113 if (vfd->vidioc_g_std) 1123 if (ops->vidioc_g_std)
1114 ret = vfd->vidioc_g_std(file, fh, id); 1124 ret = ops->vidioc_g_std(file, fh, id);
1115 else 1125 else
1116 *id = vfd->current_norm; 1126 *id = vfd->current_norm;
1117 1127
@@ -1130,8 +1140,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1130 break; 1140 break;
1131 1141
1132 /* Calls the specific handler */ 1142 /* Calls the specific handler */
1133 if (vfd->vidioc_s_std) 1143 if (ops->vidioc_s_std)
1134 ret = vfd->vidioc_s_std(file, fh, &norm); 1144 ret = ops->vidioc_s_std(file, fh, &norm);
1135 else 1145 else
1136 ret = -EINVAL; 1146 ret = -EINVAL;
1137 1147
@@ -1144,9 +1154,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1144 { 1154 {
1145 v4l2_std_id *p = arg; 1155 v4l2_std_id *p = arg;
1146 1156
1147 if (!vfd->vidioc_querystd) 1157 if (!ops->vidioc_querystd)
1148 break; 1158 break;
1149 ret = vfd->vidioc_querystd(file, fh, arg); 1159 ret = ops->vidioc_querystd(file, fh, arg);
1150 if (!ret) 1160 if (!ret)
1151 dbgarg(cmd, "detected std=%08Lx\n", 1161 dbgarg(cmd, "detected std=%08Lx\n",
1152 (unsigned long long)*p); 1162 (unsigned long long)*p);
@@ -1159,12 +1169,12 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1159 struct v4l2_input *p = arg; 1169 struct v4l2_input *p = arg;
1160 int i = p->index; 1170 int i = p->index;
1161 1171
1162 if (!vfd->vidioc_enum_input) 1172 if (!ops->vidioc_enum_input)
1163 break; 1173 break;
1164 memset(p, 0, sizeof(*p)); 1174 memset(p, 0, sizeof(*p));
1165 p->index = i; 1175 p->index = i;
1166 1176
1167 ret = vfd->vidioc_enum_input(file, fh, p); 1177 ret = ops->vidioc_enum_input(file, fh, p);
1168 if (!ret) 1178 if (!ret)
1169 dbgarg(cmd, "index=%d, name=%s, type=%d, " 1179 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1170 "audioset=%d, " 1180 "audioset=%d, "
@@ -1179,9 +1189,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1179 { 1189 {
1180 unsigned int *i = arg; 1190 unsigned int *i = arg;
1181 1191
1182 if (!vfd->vidioc_g_input) 1192 if (!ops->vidioc_g_input)
1183 break; 1193 break;
1184 ret = vfd->vidioc_g_input(file, fh, i); 1194 ret = ops->vidioc_g_input(file, fh, i);
1185 if (!ret) 1195 if (!ret)
1186 dbgarg(cmd, "value=%d\n", *i); 1196 dbgarg(cmd, "value=%d\n", *i);
1187 break; 1197 break;
@@ -1190,10 +1200,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1190 { 1200 {
1191 unsigned int *i = arg; 1201 unsigned int *i = arg;
1192 1202
1193 if (!vfd->vidioc_s_input) 1203 if (!ops->vidioc_s_input)
1194 break; 1204 break;
1195 dbgarg(cmd, "value=%d\n", *i); 1205 dbgarg(cmd, "value=%d\n", *i);
1196 ret = vfd->vidioc_s_input(file, fh, *i); 1206 ret = ops->vidioc_s_input(file, fh, *i);
1197 break; 1207 break;
1198 } 1208 }
1199 1209
@@ -1203,12 +1213,12 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1203 struct v4l2_output *p = arg; 1213 struct v4l2_output *p = arg;
1204 int i = p->index; 1214 int i = p->index;
1205 1215
1206 if (!vfd->vidioc_enum_output) 1216 if (!ops->vidioc_enum_output)
1207 break; 1217 break;
1208 memset(p, 0, sizeof(*p)); 1218 memset(p, 0, sizeof(*p));
1209 p->index = i; 1219 p->index = i;
1210 1220
1211 ret = vfd->vidioc_enum_output(file, fh, p); 1221 ret = ops->vidioc_enum_output(file, fh, p);
1212 if (!ret) 1222 if (!ret)
1213 dbgarg(cmd, "index=%d, name=%s, type=%d, " 1223 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1214 "audioset=0x%x, " 1224 "audioset=0x%x, "
@@ -1221,9 +1231,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1221 { 1231 {
1222 unsigned int *i = arg; 1232 unsigned int *i = arg;
1223 1233
1224 if (!vfd->vidioc_g_output) 1234 if (!ops->vidioc_g_output)
1225 break; 1235 break;
1226 ret = vfd->vidioc_g_output(file, fh, i); 1236 ret = ops->vidioc_g_output(file, fh, i);
1227 if (!ret) 1237 if (!ret)
1228 dbgarg(cmd, "value=%d\n", *i); 1238 dbgarg(cmd, "value=%d\n", *i);
1229 break; 1239 break;
@@ -1232,10 +1242,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1232 { 1242 {
1233 unsigned int *i = arg; 1243 unsigned int *i = arg;
1234 1244
1235 if (!vfd->vidioc_s_output) 1245 if (!ops->vidioc_s_output)
1236 break; 1246 break;
1237 dbgarg(cmd, "value=%d\n", *i); 1247 dbgarg(cmd, "value=%d\n", *i);
1238 ret = vfd->vidioc_s_output(file, fh, *i); 1248 ret = ops->vidioc_s_output(file, fh, *i);
1239 break; 1249 break;
1240 } 1250 }
1241 1251
@@ -1244,9 +1254,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1244 { 1254 {
1245 struct v4l2_queryctrl *p = arg; 1255 struct v4l2_queryctrl *p = arg;
1246 1256
1247 if (!vfd->vidioc_queryctrl) 1257 if (!ops->vidioc_queryctrl)
1248 break; 1258 break;
1249 ret = vfd->vidioc_queryctrl(file, fh, p); 1259 ret = ops->vidioc_queryctrl(file, fh, p);
1250 if (!ret) 1260 if (!ret)
1251 dbgarg(cmd, "id=0x%x, type=%d, name=%s, min/max=%d/%d, " 1261 dbgarg(cmd, "id=0x%x, type=%d, name=%s, min/max=%d/%d, "
1252 "step=%d, default=%d, flags=0x%08x\n", 1262 "step=%d, default=%d, flags=0x%08x\n",
@@ -1261,9 +1271,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1261 { 1271 {
1262 struct v4l2_control *p = arg; 1272 struct v4l2_control *p = arg;
1263 1273
1264 if (vfd->vidioc_g_ctrl) 1274 if (ops->vidioc_g_ctrl)
1265 ret = vfd->vidioc_g_ctrl(file, fh, p); 1275 ret = ops->vidioc_g_ctrl(file, fh, p);
1266 else if (vfd->vidioc_g_ext_ctrls) { 1276 else if (ops->vidioc_g_ext_ctrls) {
1267 struct v4l2_ext_controls ctrls; 1277 struct v4l2_ext_controls ctrls;
1268 struct v4l2_ext_control ctrl; 1278 struct v4l2_ext_control ctrl;
1269 1279
@@ -1273,7 +1283,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1273 ctrl.id = p->id; 1283 ctrl.id = p->id;
1274 ctrl.value = p->value; 1284 ctrl.value = p->value;
1275 if (check_ext_ctrls(&ctrls, 1)) { 1285 if (check_ext_ctrls(&ctrls, 1)) {
1276 ret = vfd->vidioc_g_ext_ctrls(file, fh, &ctrls); 1286 ret = ops->vidioc_g_ext_ctrls(file, fh, &ctrls);
1277 if (ret == 0) 1287 if (ret == 0)
1278 p->value = ctrl.value; 1288 p->value = ctrl.value;
1279 } 1289 }
@@ -1291,16 +1301,16 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1291 struct v4l2_ext_controls ctrls; 1301 struct v4l2_ext_controls ctrls;
1292 struct v4l2_ext_control ctrl; 1302 struct v4l2_ext_control ctrl;
1293 1303
1294 if (!vfd->vidioc_s_ctrl && !vfd->vidioc_s_ext_ctrls) 1304 if (!ops->vidioc_s_ctrl && !ops->vidioc_s_ext_ctrls)
1295 break; 1305 break;
1296 1306
1297 dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value); 1307 dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value);
1298 1308
1299 if (vfd->vidioc_s_ctrl) { 1309 if (ops->vidioc_s_ctrl) {
1300 ret = vfd->vidioc_s_ctrl(file, fh, p); 1310 ret = ops->vidioc_s_ctrl(file, fh, p);
1301 break; 1311 break;
1302 } 1312 }
1303 if (!vfd->vidioc_s_ext_ctrls) 1313 if (!ops->vidioc_s_ext_ctrls)
1304 break; 1314 break;
1305 1315
1306 ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(p->id); 1316 ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(p->id);
@@ -1309,7 +1319,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1309 ctrl.id = p->id; 1319 ctrl.id = p->id;
1310 ctrl.value = p->value; 1320 ctrl.value = p->value;
1311 if (check_ext_ctrls(&ctrls, 1)) 1321 if (check_ext_ctrls(&ctrls, 1))
1312 ret = vfd->vidioc_s_ext_ctrls(file, fh, &ctrls); 1322 ret = ops->vidioc_s_ext_ctrls(file, fh, &ctrls);
1313 break; 1323 break;
1314 } 1324 }
1315 case VIDIOC_G_EXT_CTRLS: 1325 case VIDIOC_G_EXT_CTRLS:
@@ -1317,10 +1327,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1317 struct v4l2_ext_controls *p = arg; 1327 struct v4l2_ext_controls *p = arg;
1318 1328
1319 p->error_idx = p->count; 1329 p->error_idx = p->count;
1320 if (!vfd->vidioc_g_ext_ctrls) 1330 if (!ops->vidioc_g_ext_ctrls)
1321 break; 1331 break;
1322 if (check_ext_ctrls(p, 0)) 1332 if (check_ext_ctrls(p, 0))
1323 ret = vfd->vidioc_g_ext_ctrls(file, fh, p); 1333 ret = ops->vidioc_g_ext_ctrls(file, fh, p);
1324 v4l_print_ext_ctrls(cmd, vfd, p, !ret); 1334 v4l_print_ext_ctrls(cmd, vfd, p, !ret);
1325 break; 1335 break;
1326 } 1336 }
@@ -1329,11 +1339,11 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1329 struct v4l2_ext_controls *p = arg; 1339 struct v4l2_ext_controls *p = arg;
1330 1340
1331 p->error_idx = p->count; 1341 p->error_idx = p->count;
1332 if (!vfd->vidioc_s_ext_ctrls) 1342 if (!ops->vidioc_s_ext_ctrls)
1333 break; 1343 break;
1334 v4l_print_ext_ctrls(cmd, vfd, p, 1); 1344 v4l_print_ext_ctrls(cmd, vfd, p, 1);
1335 if (check_ext_ctrls(p, 0)) 1345 if (check_ext_ctrls(p, 0))
1336 ret = vfd->vidioc_s_ext_ctrls(file, fh, p); 1346 ret = ops->vidioc_s_ext_ctrls(file, fh, p);
1337 break; 1347 break;
1338 } 1348 }
1339 case VIDIOC_TRY_EXT_CTRLS: 1349 case VIDIOC_TRY_EXT_CTRLS:
@@ -1341,20 +1351,20 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1341 struct v4l2_ext_controls *p = arg; 1351 struct v4l2_ext_controls *p = arg;
1342 1352
1343 p->error_idx = p->count; 1353 p->error_idx = p->count;
1344 if (!vfd->vidioc_try_ext_ctrls) 1354 if (!ops->vidioc_try_ext_ctrls)
1345 break; 1355 break;
1346 v4l_print_ext_ctrls(cmd, vfd, p, 1); 1356 v4l_print_ext_ctrls(cmd, vfd, p, 1);
1347 if (check_ext_ctrls(p, 0)) 1357 if (check_ext_ctrls(p, 0))
1348 ret = vfd->vidioc_try_ext_ctrls(file, fh, p); 1358 ret = ops->vidioc_try_ext_ctrls(file, fh, p);
1349 break; 1359 break;
1350 } 1360 }
1351 case VIDIOC_QUERYMENU: 1361 case VIDIOC_QUERYMENU:
1352 { 1362 {
1353 struct v4l2_querymenu *p = arg; 1363 struct v4l2_querymenu *p = arg;
1354 1364
1355 if (!vfd->vidioc_querymenu) 1365 if (!ops->vidioc_querymenu)
1356 break; 1366 break;
1357 ret = vfd->vidioc_querymenu(file, fh, p); 1367 ret = ops->vidioc_querymenu(file, fh, p);
1358 if (!ret) 1368 if (!ret)
1359 dbgarg(cmd, "id=0x%x, index=%d, name=%s\n", 1369 dbgarg(cmd, "id=0x%x, index=%d, name=%s\n",
1360 p->id, p->index, p->name); 1370 p->id, p->index, p->name);
@@ -1368,9 +1378,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1368 { 1378 {
1369 struct v4l2_audio *p = arg; 1379 struct v4l2_audio *p = arg;
1370 1380
1371 if (!vfd->vidioc_enumaudio) 1381 if (!ops->vidioc_enumaudio)
1372 break; 1382 break;
1373 ret = vfd->vidioc_enumaudio(file, fh, p); 1383 ret = ops->vidioc_enumaudio(file, fh, p);
1374 if (!ret) 1384 if (!ret)
1375 dbgarg(cmd, "index=%d, name=%s, capability=0x%x, " 1385 dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
1376 "mode=0x%x\n", p->index, p->name, 1386 "mode=0x%x\n", p->index, p->name,
@@ -1384,12 +1394,12 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1384 struct v4l2_audio *p = arg; 1394 struct v4l2_audio *p = arg;
1385 __u32 index = p->index; 1395 __u32 index = p->index;
1386 1396
1387 if (!vfd->vidioc_g_audio) 1397 if (!ops->vidioc_g_audio)
1388 break; 1398 break;
1389 1399
1390 memset(p, 0, sizeof(*p)); 1400 memset(p, 0, sizeof(*p));
1391 p->index = index; 1401 p->index = index;
1392 ret = vfd->vidioc_g_audio(file, fh, p); 1402 ret = ops->vidioc_g_audio(file, fh, p);
1393 if (!ret) 1403 if (!ret)
1394 dbgarg(cmd, "index=%d, name=%s, capability=0x%x, " 1404 dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
1395 "mode=0x%x\n", p->index, 1405 "mode=0x%x\n", p->index,
@@ -1402,22 +1412,22 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1402 { 1412 {
1403 struct v4l2_audio *p = arg; 1413 struct v4l2_audio *p = arg;
1404 1414
1405 if (!vfd->vidioc_s_audio) 1415 if (!ops->vidioc_s_audio)
1406 break; 1416 break;
1407 dbgarg(cmd, "index=%d, name=%s, capability=0x%x, " 1417 dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
1408 "mode=0x%x\n", p->index, p->name, 1418 "mode=0x%x\n", p->index, p->name,
1409 p->capability, p->mode); 1419 p->capability, p->mode);
1410 ret = vfd->vidioc_s_audio(file, fh, p); 1420 ret = ops->vidioc_s_audio(file, fh, p);
1411 break; 1421 break;
1412 } 1422 }
1413 case VIDIOC_ENUMAUDOUT: 1423 case VIDIOC_ENUMAUDOUT:
1414 { 1424 {
1415 struct v4l2_audioout *p = arg; 1425 struct v4l2_audioout *p = arg;
1416 1426
1417 if (!vfd->vidioc_enumaudout) 1427 if (!ops->vidioc_enumaudout)
1418 break; 1428 break;
1419 dbgarg(cmd, "Enum for index=%d\n", p->index); 1429 dbgarg(cmd, "Enum for index=%d\n", p->index);
1420 ret = vfd->vidioc_enumaudout(file, fh, p); 1430 ret = ops->vidioc_enumaudout(file, fh, p);
1421 if (!ret) 1431 if (!ret)
1422 dbgarg2("index=%d, name=%s, capability=%d, " 1432 dbgarg2("index=%d, name=%s, capability=%d, "
1423 "mode=%d\n", p->index, p->name, 1433 "mode=%d\n", p->index, p->name,
@@ -1428,10 +1438,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1428 { 1438 {
1429 struct v4l2_audioout *p = arg; 1439 struct v4l2_audioout *p = arg;
1430 1440
1431 if (!vfd->vidioc_g_audout) 1441 if (!ops->vidioc_g_audout)
1432 break; 1442 break;
1433 dbgarg(cmd, "Enum for index=%d\n", p->index); 1443 dbgarg(cmd, "Enum for index=%d\n", p->index);
1434 ret = vfd->vidioc_g_audout(file, fh, p); 1444 ret = ops->vidioc_g_audout(file, fh, p);
1435 if (!ret) 1445 if (!ret)
1436 dbgarg2("index=%d, name=%s, capability=%d, " 1446 dbgarg2("index=%d, name=%s, capability=%d, "
1437 "mode=%d\n", p->index, p->name, 1447 "mode=%d\n", p->index, p->name,
@@ -1442,22 +1452,22 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1442 { 1452 {
1443 struct v4l2_audioout *p = arg; 1453 struct v4l2_audioout *p = arg;
1444 1454
1445 if (!vfd->vidioc_s_audout) 1455 if (!ops->vidioc_s_audout)
1446 break; 1456 break;
1447 dbgarg(cmd, "index=%d, name=%s, capability=%d, " 1457 dbgarg(cmd, "index=%d, name=%s, capability=%d, "
1448 "mode=%d\n", p->index, p->name, 1458 "mode=%d\n", p->index, p->name,
1449 p->capability, p->mode); 1459 p->capability, p->mode);
1450 1460
1451 ret = vfd->vidioc_s_audout(file, fh, p); 1461 ret = ops->vidioc_s_audout(file, fh, p);
1452 break; 1462 break;
1453 } 1463 }
1454 case VIDIOC_G_MODULATOR: 1464 case VIDIOC_G_MODULATOR:
1455 { 1465 {
1456 struct v4l2_modulator *p = arg; 1466 struct v4l2_modulator *p = arg;
1457 1467
1458 if (!vfd->vidioc_g_modulator) 1468 if (!ops->vidioc_g_modulator)
1459 break; 1469 break;
1460 ret = vfd->vidioc_g_modulator(file, fh, p); 1470 ret = ops->vidioc_g_modulator(file, fh, p);
1461 if (!ret) 1471 if (!ret)
1462 dbgarg(cmd, "index=%d, name=%s, " 1472 dbgarg(cmd, "index=%d, name=%s, "
1463 "capability=%d, rangelow=%d," 1473 "capability=%d, rangelow=%d,"
@@ -1471,23 +1481,23 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1471 { 1481 {
1472 struct v4l2_modulator *p = arg; 1482 struct v4l2_modulator *p = arg;
1473 1483
1474 if (!vfd->vidioc_s_modulator) 1484 if (!ops->vidioc_s_modulator)
1475 break; 1485 break;
1476 dbgarg(cmd, "index=%d, name=%s, capability=%d, " 1486 dbgarg(cmd, "index=%d, name=%s, capability=%d, "
1477 "rangelow=%d, rangehigh=%d, txsubchans=%d\n", 1487 "rangelow=%d, rangehigh=%d, txsubchans=%d\n",
1478 p->index, p->name, p->capability, p->rangelow, 1488 p->index, p->name, p->capability, p->rangelow,
1479 p->rangehigh, p->txsubchans); 1489 p->rangehigh, p->txsubchans);
1480 ret = vfd->vidioc_s_modulator(file, fh, p); 1490 ret = ops->vidioc_s_modulator(file, fh, p);
1481 break; 1491 break;
1482 } 1492 }
1483 case VIDIOC_G_CROP: 1493 case VIDIOC_G_CROP:
1484 { 1494 {
1485 struct v4l2_crop *p = arg; 1495 struct v4l2_crop *p = arg;
1486 1496
1487 if (!vfd->vidioc_g_crop) 1497 if (!ops->vidioc_g_crop)
1488 break; 1498 break;
1489 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); 1499 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
1490 ret = vfd->vidioc_g_crop(file, fh, p); 1500 ret = ops->vidioc_g_crop(file, fh, p);
1491 if (!ret) 1501 if (!ret)
1492 dbgrect(vfd, "", &p->c); 1502 dbgrect(vfd, "", &p->c);
1493 break; 1503 break;
@@ -1496,11 +1506,11 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1496 { 1506 {
1497 struct v4l2_crop *p = arg; 1507 struct v4l2_crop *p = arg;
1498 1508
1499 if (!vfd->vidioc_s_crop) 1509 if (!ops->vidioc_s_crop)
1500 break; 1510 break;
1501 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); 1511 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
1502 dbgrect(vfd, "", &p->c); 1512 dbgrect(vfd, "", &p->c);
1503 ret = vfd->vidioc_s_crop(file, fh, p); 1513 ret = ops->vidioc_s_crop(file, fh, p);
1504 break; 1514 break;
1505 } 1515 }
1506 case VIDIOC_CROPCAP: 1516 case VIDIOC_CROPCAP:
@@ -1508,10 +1518,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1508 struct v4l2_cropcap *p = arg; 1518 struct v4l2_cropcap *p = arg;
1509 1519
1510 /*FIXME: Should also show v4l2_fract pixelaspect */ 1520 /*FIXME: Should also show v4l2_fract pixelaspect */
1511 if (!vfd->vidioc_cropcap) 1521 if (!ops->vidioc_cropcap)
1512 break; 1522 break;
1513 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); 1523 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
1514 ret = vfd->vidioc_cropcap(file, fh, p); 1524 ret = ops->vidioc_cropcap(file, fh, p);
1515 if (!ret) { 1525 if (!ret) {
1516 dbgrect(vfd, "bounds ", &p->bounds); 1526 dbgrect(vfd, "bounds ", &p->bounds);
1517 dbgrect(vfd, "defrect ", &p->defrect); 1527 dbgrect(vfd, "defrect ", &p->defrect);
@@ -1522,9 +1532,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1522 { 1532 {
1523 struct v4l2_jpegcompression *p = arg; 1533 struct v4l2_jpegcompression *p = arg;
1524 1534
1525 if (!vfd->vidioc_g_jpegcomp) 1535 if (!ops->vidioc_g_jpegcomp)
1526 break; 1536 break;
1527 ret = vfd->vidioc_g_jpegcomp(file, fh, p); 1537 ret = ops->vidioc_g_jpegcomp(file, fh, p);
1528 if (!ret) 1538 if (!ret)
1529 dbgarg(cmd, "quality=%d, APPn=%d, " 1539 dbgarg(cmd, "quality=%d, APPn=%d, "
1530 "APP_len=%d, COM_len=%d, " 1540 "APP_len=%d, COM_len=%d, "
@@ -1537,22 +1547,22 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1537 { 1547 {
1538 struct v4l2_jpegcompression *p = arg; 1548 struct v4l2_jpegcompression *p = arg;
1539 1549
1540 if (!vfd->vidioc_g_jpegcomp) 1550 if (!ops->vidioc_g_jpegcomp)
1541 break; 1551 break;
1542 dbgarg(cmd, "quality=%d, APPn=%d, APP_len=%d, " 1552 dbgarg(cmd, "quality=%d, APPn=%d, APP_len=%d, "
1543 "COM_len=%d, jpeg_markers=%d\n", 1553 "COM_len=%d, jpeg_markers=%d\n",
1544 p->quality, p->APPn, p->APP_len, 1554 p->quality, p->APPn, p->APP_len,
1545 p->COM_len, p->jpeg_markers); 1555 p->COM_len, p->jpeg_markers);
1546 ret = vfd->vidioc_s_jpegcomp(file, fh, p); 1556 ret = ops->vidioc_s_jpegcomp(file, fh, p);
1547 break; 1557 break;
1548 } 1558 }
1549 case VIDIOC_G_ENC_INDEX: 1559 case VIDIOC_G_ENC_INDEX:
1550 { 1560 {
1551 struct v4l2_enc_idx *p = arg; 1561 struct v4l2_enc_idx *p = arg;
1552 1562
1553 if (!vfd->vidioc_g_enc_index) 1563 if (!ops->vidioc_g_enc_index)
1554 break; 1564 break;
1555 ret = vfd->vidioc_g_enc_index(file, fh, p); 1565 ret = ops->vidioc_g_enc_index(file, fh, p);
1556 if (!ret) 1566 if (!ret)
1557 dbgarg(cmd, "entries=%d, entries_cap=%d\n", 1567 dbgarg(cmd, "entries=%d, entries_cap=%d\n",
1558 p->entries, p->entries_cap); 1568 p->entries, p->entries_cap);
@@ -1562,10 +1572,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1562 { 1572 {
1563 struct v4l2_encoder_cmd *p = arg; 1573 struct v4l2_encoder_cmd *p = arg;
1564 1574
1565 if (!vfd->vidioc_encoder_cmd) 1575 if (!ops->vidioc_encoder_cmd)
1566 break; 1576 break;
1567 memset(&p->raw, 0, sizeof(p->raw)); 1577 memset(&p->raw, 0, sizeof(p->raw));
1568 ret = vfd->vidioc_encoder_cmd(file, fh, p); 1578 ret = ops->vidioc_encoder_cmd(file, fh, p);
1569 if (!ret) 1579 if (!ret)
1570 dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags); 1580 dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags);
1571 break; 1581 break;
@@ -1574,10 +1584,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1574 { 1584 {
1575 struct v4l2_encoder_cmd *p = arg; 1585 struct v4l2_encoder_cmd *p = arg;
1576 1586
1577 if (!vfd->vidioc_try_encoder_cmd) 1587 if (!ops->vidioc_try_encoder_cmd)
1578 break; 1588 break;
1579 memset(&p->raw, 0, sizeof(p->raw)); 1589 memset(&p->raw, 0, sizeof(p->raw));
1580 ret = vfd->vidioc_try_encoder_cmd(file, fh, p); 1590 ret = ops->vidioc_try_encoder_cmd(file, fh, p);
1581 if (!ret) 1591 if (!ret)
1582 dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags); 1592 dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags);
1583 break; 1593 break;
@@ -1590,8 +1600,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1590 memset(p, 0, sizeof(*p)); 1600 memset(p, 0, sizeof(*p));
1591 p->type = type; 1601 p->type = type;
1592 1602
1593 if (vfd->vidioc_g_parm) { 1603 if (ops->vidioc_g_parm) {
1594 ret = vfd->vidioc_g_parm(file, fh, p); 1604 ret = ops->vidioc_g_parm(file, fh, p);
1595 } else { 1605 } else {
1596 struct v4l2_standard s; 1606 struct v4l2_standard s;
1597 1607
@@ -1612,10 +1622,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1612 { 1622 {
1613 struct v4l2_streamparm *p = arg; 1623 struct v4l2_streamparm *p = arg;
1614 1624
1615 if (!vfd->vidioc_s_parm) 1625 if (!ops->vidioc_s_parm)
1616 break; 1626 break;
1617 dbgarg(cmd, "type=%d\n", p->type); 1627 dbgarg(cmd, "type=%d\n", p->type);
1618 ret = vfd->vidioc_s_parm(file, fh, p); 1628 ret = ops->vidioc_s_parm(file, fh, p);
1619 break; 1629 break;
1620 } 1630 }
1621 case VIDIOC_G_TUNER: 1631 case VIDIOC_G_TUNER:
@@ -1623,13 +1633,13 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1623 struct v4l2_tuner *p = arg; 1633 struct v4l2_tuner *p = arg;
1624 __u32 index = p->index; 1634 __u32 index = p->index;
1625 1635
1626 if (!vfd->vidioc_g_tuner) 1636 if (!ops->vidioc_g_tuner)
1627 break; 1637 break;
1628 1638
1629 memset(p, 0, sizeof(*p)); 1639 memset(p, 0, sizeof(*p));
1630 p->index = index; 1640 p->index = index;
1631 1641
1632 ret = vfd->vidioc_g_tuner(file, fh, p); 1642 ret = ops->vidioc_g_tuner(file, fh, p);
1633 if (!ret) 1643 if (!ret)
1634 dbgarg(cmd, "index=%d, name=%s, type=%d, " 1644 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1635 "capability=0x%x, rangelow=%d, " 1645 "capability=0x%x, rangelow=%d, "
@@ -1645,7 +1655,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1645 { 1655 {
1646 struct v4l2_tuner *p = arg; 1656 struct v4l2_tuner *p = arg;
1647 1657
1648 if (!vfd->vidioc_s_tuner) 1658 if (!ops->vidioc_s_tuner)
1649 break; 1659 break;
1650 dbgarg(cmd, "index=%d, name=%s, type=%d, " 1660 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1651 "capability=0x%x, rangelow=%d, " 1661 "capability=0x%x, rangelow=%d, "
@@ -1655,19 +1665,19 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1655 p->capability, p->rangelow, 1665 p->capability, p->rangelow,
1656 p->rangehigh, p->signal, p->afc, 1666 p->rangehigh, p->signal, p->afc,
1657 p->rxsubchans, p->audmode); 1667 p->rxsubchans, p->audmode);
1658 ret = vfd->vidioc_s_tuner(file, fh, p); 1668 ret = ops->vidioc_s_tuner(file, fh, p);
1659 break; 1669 break;
1660 } 1670 }
1661 case VIDIOC_G_FREQUENCY: 1671 case VIDIOC_G_FREQUENCY:
1662 { 1672 {
1663 struct v4l2_frequency *p = arg; 1673 struct v4l2_frequency *p = arg;
1664 1674
1665 if (!vfd->vidioc_g_frequency) 1675 if (!ops->vidioc_g_frequency)
1666 break; 1676 break;
1667 1677
1668 memset(p->reserved, 0, sizeof(p->reserved)); 1678 memset(p->reserved, 0, sizeof(p->reserved));
1669 1679
1670 ret = vfd->vidioc_g_frequency(file, fh, p); 1680 ret = ops->vidioc_g_frequency(file, fh, p);
1671 if (!ret) 1681 if (!ret)
1672 dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n", 1682 dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n",
1673 p->tuner, p->type, p->frequency); 1683 p->tuner, p->type, p->frequency);
@@ -1677,11 +1687,11 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1677 { 1687 {
1678 struct v4l2_frequency *p = arg; 1688 struct v4l2_frequency *p = arg;
1679 1689
1680 if (!vfd->vidioc_s_frequency) 1690 if (!ops->vidioc_s_frequency)
1681 break; 1691 break;
1682 dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n", 1692 dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n",
1683 p->tuner, p->type, p->frequency); 1693 p->tuner, p->type, p->frequency);
1684 ret = vfd->vidioc_s_frequency(file, fh, p); 1694 ret = ops->vidioc_s_frequency(file, fh, p);
1685 break; 1695 break;
1686 } 1696 }
1687 case VIDIOC_G_SLICED_VBI_CAP: 1697 case VIDIOC_G_SLICED_VBI_CAP:
@@ -1689,21 +1699,21 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1689 struct v4l2_sliced_vbi_cap *p = arg; 1699 struct v4l2_sliced_vbi_cap *p = arg;
1690 __u32 type = p->type; 1700 __u32 type = p->type;
1691 1701
1692 if (!vfd->vidioc_g_sliced_vbi_cap) 1702 if (!ops->vidioc_g_sliced_vbi_cap)
1693 break; 1703 break;
1694 memset(p, 0, sizeof(*p)); 1704 memset(p, 0, sizeof(*p));
1695 p->type = type; 1705 p->type = type;
1696 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); 1706 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
1697 ret = vfd->vidioc_g_sliced_vbi_cap(file, fh, p); 1707 ret = ops->vidioc_g_sliced_vbi_cap(file, fh, p);
1698 if (!ret) 1708 if (!ret)
1699 dbgarg2("service_set=%d\n", p->service_set); 1709 dbgarg2("service_set=%d\n", p->service_set);
1700 break; 1710 break;
1701 } 1711 }
1702 case VIDIOC_LOG_STATUS: 1712 case VIDIOC_LOG_STATUS:
1703 { 1713 {
1704 if (!vfd->vidioc_log_status) 1714 if (!ops->vidioc_log_status)
1705 break; 1715 break;
1706 ret = vfd->vidioc_log_status(file, fh); 1716 ret = ops->vidioc_log_status(file, fh);
1707 break; 1717 break;
1708 } 1718 }
1709#ifdef CONFIG_VIDEO_ADV_DEBUG 1719#ifdef CONFIG_VIDEO_ADV_DEBUG
@@ -1713,8 +1723,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1713 1723
1714 if (!capable(CAP_SYS_ADMIN)) 1724 if (!capable(CAP_SYS_ADMIN))
1715 ret = -EPERM; 1725 ret = -EPERM;
1716 else if (vfd->vidioc_g_register) 1726 else if (ops->vidioc_g_register)
1717 ret = vfd->vidioc_g_register(file, fh, p); 1727 ret = ops->vidioc_g_register(file, fh, p);
1718 break; 1728 break;
1719 } 1729 }
1720 case VIDIOC_DBG_S_REGISTER: 1730 case VIDIOC_DBG_S_REGISTER:
@@ -1723,8 +1733,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1723 1733
1724 if (!capable(CAP_SYS_ADMIN)) 1734 if (!capable(CAP_SYS_ADMIN))
1725 ret = -EPERM; 1735 ret = -EPERM;
1726 else if (vfd->vidioc_s_register) 1736 else if (ops->vidioc_s_register)
1727 ret = vfd->vidioc_s_register(file, fh, p); 1737 ret = ops->vidioc_s_register(file, fh, p);
1728 break; 1738 break;
1729 } 1739 }
1730#endif 1740#endif
@@ -1732,30 +1742,30 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1732 { 1742 {
1733 struct v4l2_chip_ident *p = arg; 1743 struct v4l2_chip_ident *p = arg;
1734 1744
1735 if (!vfd->vidioc_g_chip_ident) 1745 if (!ops->vidioc_g_chip_ident)
1736 break; 1746 break;
1737 ret = vfd->vidioc_g_chip_ident(file, fh, p); 1747 ret = ops->vidioc_g_chip_ident(file, fh, p);
1738 if (!ret) 1748 if (!ret)
1739 dbgarg(cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision); 1749 dbgarg(cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision);
1740 break; 1750 break;
1741 } 1751 }
1742 default:
1743 {
1744 if (!vfd->vidioc_default)
1745 break;
1746 ret = vfd->vidioc_default(file, fh, cmd, arg);
1747 break;
1748 }
1749 case VIDIOC_S_HW_FREQ_SEEK: 1752 case VIDIOC_S_HW_FREQ_SEEK:
1750 { 1753 {
1751 struct v4l2_hw_freq_seek *p = arg; 1754 struct v4l2_hw_freq_seek *p = arg;
1752 1755
1753 if (!vfd->vidioc_s_hw_freq_seek) 1756 if (!ops->vidioc_s_hw_freq_seek)
1754 break; 1757 break;
1755 dbgarg(cmd, 1758 dbgarg(cmd,
1756 "tuner=%d, type=%d, seek_upward=%d, wrap_around=%d\n", 1759 "tuner=%d, type=%d, seek_upward=%d, wrap_around=%d\n",
1757 p->tuner, p->type, p->seek_upward, p->wrap_around); 1760 p->tuner, p->type, p->seek_upward, p->wrap_around);
1758 ret = vfd->vidioc_s_hw_freq_seek(file, fh, p); 1761 ret = ops->vidioc_s_hw_freq_seek(file, fh, p);
1762 break;
1763 }
1764 default:
1765 {
1766 if (!ops->vidioc_default)
1767 break;
1768 ret = ops->vidioc_default(file, fh, cmd, arg);
1759 break; 1769 break;
1760 } 1770 }
1761 } /* switch */ 1771 } /* switch */
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index e4b3a006c71e..639210e52647 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -1066,13 +1066,7 @@ static const struct file_operations vivi_fops = {
1066 .llseek = no_llseek, 1066 .llseek = no_llseek,
1067}; 1067};
1068 1068
1069static struct video_device vivi_template = { 1069static const struct v4l2_ioctl_ops vivi_ioctl_ops = {
1070 .name = "vivi",
1071 .type = VID_TYPE_CAPTURE,
1072 .fops = &vivi_fops,
1073 .minor = -1,
1074 .release = video_device_release,
1075
1076 .vidioc_querycap = vidioc_querycap, 1070 .vidioc_querycap = vidioc_querycap,
1077 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 1071 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
1078 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 1072 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
@@ -1094,6 +1088,16 @@ static struct video_device vivi_template = {
1094#ifdef CONFIG_VIDEO_V4L1_COMPAT 1088#ifdef CONFIG_VIDEO_V4L1_COMPAT
1095 .vidiocgmbuf = vidiocgmbuf, 1089 .vidiocgmbuf = vidiocgmbuf,
1096#endif 1090#endif
1091};
1092
1093static struct video_device vivi_template = {
1094 .name = "vivi",
1095 .type = VID_TYPE_CAPTURE,
1096 .fops = &vivi_fops,
1097 .ioctl_ops = &vivi_ioctl_ops,
1098 .minor = -1,
1099 .release = video_device_release,
1100
1097 .tvnorms = V4L2_STD_525_60, 1101 .tvnorms = V4L2_STD_525_60,
1098 .current_norm = V4L2_STD_NTSC_M, 1102 .current_norm = V4L2_STD_NTSC_M,
1099}; 1103};
diff --git a/drivers/media/video/zr364xx.c b/drivers/media/video/zr364xx.c
index ea5265c22983..617ed2856b22 100644
--- a/drivers/media/video/zr364xx.c
+++ b/drivers/media/video/zr364xx.c
@@ -762,14 +762,7 @@ static const struct file_operations zr364xx_fops = {
762 .llseek = no_llseek, 762 .llseek = no_llseek,
763}; 763};
764 764
765static struct video_device zr364xx_template = { 765static const struct v4l2_ioctl_ops zr364xx_ioctl_ops = {
766 .owner = THIS_MODULE,
767 .name = DRIVER_DESC,
768 .type = VID_TYPE_CAPTURE,
769 .fops = &zr364xx_fops,
770 .release = video_device_release,
771 .minor = -1,
772
773 .vidioc_querycap = zr364xx_vidioc_querycap, 766 .vidioc_querycap = zr364xx_vidioc_querycap,
774 .vidioc_enum_fmt_vid_cap = zr364xx_vidioc_enum_fmt_vid_cap, 767 .vidioc_enum_fmt_vid_cap = zr364xx_vidioc_enum_fmt_vid_cap,
775 .vidioc_try_fmt_vid_cap = zr364xx_vidioc_try_fmt_vid_cap, 768 .vidioc_try_fmt_vid_cap = zr364xx_vidioc_try_fmt_vid_cap,
@@ -785,6 +778,16 @@ static struct video_device zr364xx_template = {
785 .vidioc_s_ctrl = zr364xx_vidioc_s_ctrl, 778 .vidioc_s_ctrl = zr364xx_vidioc_s_ctrl,
786}; 779};
787 780
781static struct video_device zr364xx_template = {
782 .owner = THIS_MODULE,
783 .name = DRIVER_DESC,
784 .type = VID_TYPE_CAPTURE,
785 .fops = &zr364xx_fops,
786 .ioctl_ops = &zr364xx_ioctl_ops,
787 .release = video_device_release,
788 .minor = -1,
789};
790
788 791
789 792
790/*******************/ 793/*******************/