diff options
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-video.c')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-video.c | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 2d9f14d2a00b..49ab0629702e 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -38,6 +38,7 @@ | |||
38 | 38 | ||
39 | #include "em28xx.h" | 39 | #include "em28xx.h" |
40 | #include <media/v4l2-common.h> | 40 | #include <media/v4l2-common.h> |
41 | #include <media/v4l2-ioctl.h> | ||
41 | #include <media/msp3400.h> | 42 | #include <media/msp3400.h> |
42 | #include <media/tuner.h> | 43 | #include <media/tuner.h> |
43 | 44 | ||
@@ -1763,20 +1764,7 @@ static const struct file_operations em28xx_v4l_fops = { | |||
1763 | .compat_ioctl = v4l_compat_ioctl32, | 1764 | .compat_ioctl = v4l_compat_ioctl32, |
1764 | }; | 1765 | }; |
1765 | 1766 | ||
1766 | static const struct file_operations radio_fops = { | 1767 | static const struct v4l2_ioctl_ops video_ioctl_ops = { |
1767 | .owner = THIS_MODULE, | ||
1768 | .open = em28xx_v4l2_open, | ||
1769 | .release = em28xx_v4l2_close, | ||
1770 | .ioctl = video_ioctl2, | ||
1771 | .compat_ioctl = v4l_compat_ioctl32, | ||
1772 | .llseek = no_llseek, | ||
1773 | }; | ||
1774 | |||
1775 | static const struct video_device em28xx_video_template = { | ||
1776 | .fops = &em28xx_v4l_fops, | ||
1777 | .release = video_device_release, | ||
1778 | |||
1779 | .minor = -1, | ||
1780 | .vidioc_querycap = vidioc_querycap, | 1768 | .vidioc_querycap = vidioc_querycap, |
1781 | .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, | 1769 | .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, |
1782 | .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, | 1770 | .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, |
@@ -1814,16 +1802,29 @@ static const struct video_device em28xx_video_template = { | |||
1814 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | 1802 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
1815 | .vidiocgmbuf = vidiocgmbuf, | 1803 | .vidiocgmbuf = vidiocgmbuf, |
1816 | #endif | 1804 | #endif |
1805 | }; | ||
1806 | |||
1807 | static 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, | ||
1817 | 1813 | ||
1818 | .tvnorms = V4L2_STD_ALL, | 1814 | .tvnorms = V4L2_STD_ALL, |
1819 | .current_norm = V4L2_STD_PAL, | 1815 | .current_norm = V4L2_STD_PAL, |
1820 | }; | 1816 | }; |
1821 | 1817 | ||
1822 | static struct video_device em28xx_radio_template = { | 1818 | static const struct file_operations radio_fops = { |
1823 | .name = "em28xx-radio", | 1819 | .owner = THIS_MODULE, |
1824 | .type = VID_TYPE_TUNER, | 1820 | .open = em28xx_v4l2_open, |
1825 | .fops = &radio_fops, | 1821 | .release = em28xx_v4l2_close, |
1826 | .minor = -1, | 1822 | .ioctl = video_ioctl2, |
1823 | .compat_ioctl = v4l_compat_ioctl32, | ||
1824 | .llseek = no_llseek, | ||
1825 | }; | ||
1826 | |||
1827 | static const struct v4l2_ioctl_ops radio_ioctl_ops = { | ||
1827 | .vidioc_querycap = radio_querycap, | 1828 | .vidioc_querycap = radio_querycap, |
1828 | .vidioc_g_tuner = radio_g_tuner, | 1829 | .vidioc_g_tuner = radio_g_tuner, |
1829 | .vidioc_enum_input = radio_enum_input, | 1830 | .vidioc_enum_input = radio_enum_input, |
@@ -1842,6 +1843,13 @@ static struct video_device em28xx_radio_template = { | |||
1842 | #endif | 1843 | #endif |
1843 | }; | 1844 | }; |
1844 | 1845 | ||
1846 | static struct video_device em28xx_radio_template = { | ||
1847 | .name = "em28xx-radio", | ||
1848 | .fops = &radio_fops, | ||
1849 | .ioctl_ops = &radio_ioctl_ops, | ||
1850 | .minor = -1, | ||
1851 | }; | ||
1852 | |||
1845 | /******************************** usb interface ******************************/ | 1853 | /******************************** usb interface ******************************/ |
1846 | 1854 | ||
1847 | 1855 | ||
@@ -1882,7 +1890,6 @@ EXPORT_SYMBOL(em28xx_unregister_extension); | |||
1882 | 1890 | ||
1883 | static struct video_device *em28xx_vdev_init(struct em28xx *dev, | 1891 | static struct video_device *em28xx_vdev_init(struct em28xx *dev, |
1884 | const struct video_device *template, | 1892 | const struct video_device *template, |
1885 | const int type, | ||
1886 | const char *type_name) | 1893 | const char *type_name) |
1887 | { | 1894 | { |
1888 | struct video_device *vfd; | 1895 | struct video_device *vfd; |
@@ -1892,9 +1899,8 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev, | |||
1892 | return NULL; | 1899 | return NULL; |
1893 | *vfd = *template; | 1900 | *vfd = *template; |
1894 | vfd->minor = -1; | 1901 | vfd->minor = -1; |
1895 | vfd->dev = &dev->udev->dev; | 1902 | vfd->parent = &dev->udev->dev; |
1896 | vfd->release = video_device_release; | 1903 | vfd->release = video_device_release; |
1897 | vfd->type = type; | ||
1898 | vfd->debug = video_debug; | 1904 | vfd->debug = video_debug; |
1899 | 1905 | ||
1900 | snprintf(vfd->name, sizeof(vfd->name), "%s %s", | 1906 | snprintf(vfd->name, sizeof(vfd->name), "%s %s", |
@@ -1972,14 +1978,11 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1972 | list_add_tail(&dev->devlist, &em28xx_devlist); | 1978 | list_add_tail(&dev->devlist, &em28xx_devlist); |
1973 | 1979 | ||
1974 | /* allocate and fill video video_device struct */ | 1980 | /* allocate and fill video video_device struct */ |
1975 | dev->vdev = em28xx_vdev_init(dev, &em28xx_video_template, | 1981 | dev->vdev = em28xx_vdev_init(dev, &em28xx_video_template, "video"); |
1976 | VID_TYPE_CAPTURE, "video"); | ||
1977 | if (NULL == dev->vdev) { | 1982 | if (NULL == dev->vdev) { |
1978 | em28xx_errdev("cannot allocate video_device.\n"); | 1983 | em28xx_errdev("cannot allocate video_device.\n"); |
1979 | goto fail_unreg; | 1984 | goto fail_unreg; |
1980 | } | 1985 | } |
1981 | if (dev->tuner_type != TUNER_ABSENT) | ||
1982 | dev->vdev->type |= VID_TYPE_TUNER; | ||
1983 | 1986 | ||
1984 | /* register v4l2 video video_device */ | 1987 | /* register v4l2 video video_device */ |
1985 | retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, | 1988 | retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, |
@@ -1991,8 +1994,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1991 | } | 1994 | } |
1992 | 1995 | ||
1993 | /* Allocate and fill vbi video_device struct */ | 1996 | /* Allocate and fill vbi video_device struct */ |
1994 | dev->vbi_dev = em28xx_vdev_init(dev, &em28xx_video_template, | 1997 | dev->vbi_dev = em28xx_vdev_init(dev, &em28xx_video_template, "vbi"); |
1995 | VFL_TYPE_VBI, "vbi"); | ||
1996 | /* register v4l2 vbi video_device */ | 1998 | /* register v4l2 vbi video_device */ |
1997 | if (video_register_device(dev->vbi_dev, VFL_TYPE_VBI, | 1999 | if (video_register_device(dev->vbi_dev, VFL_TYPE_VBI, |
1998 | vbi_nr[dev->devno]) < 0) { | 2000 | vbi_nr[dev->devno]) < 0) { |
@@ -2002,8 +2004,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
2002 | } | 2004 | } |
2003 | 2005 | ||
2004 | if (em28xx_boards[dev->model].radio.type == EM28XX_RADIO) { | 2006 | if (em28xx_boards[dev->model].radio.type == EM28XX_RADIO) { |
2005 | dev->radio_dev = em28xx_vdev_init(dev, &em28xx_radio_template, | 2007 | dev->radio_dev = em28xx_vdev_init(dev, &em28xx_radio_template, "radio"); |
2006 | VFL_TYPE_RADIO, "radio"); | ||
2007 | if (NULL == dev->radio_dev) { | 2008 | if (NULL == dev->radio_dev) { |
2008 | em28xx_errdev("cannot allocate video_device.\n"); | 2009 | em28xx_errdev("cannot allocate video_device.\n"); |
2009 | goto fail_unreg; | 2010 | goto fail_unreg; |