aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-12-30 04:58:20 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-01-02 14:11:12 -0500
commitbec43661b1dc0075b7445223ba775674133b164d (patch)
tree2a09ad5cc78799985e5cfb789f0a23db58e70499 /drivers/media/video/em28xx
parentdfa9a5ae679ff2d23caa995d0f55a19abaf0596e (diff)
V4L/DVB (10135): v4l2: introduce v4l2_file_operations.
Introduce a struct v4l2_file_operations for v4l2 drivers. Remove the unnecessary inode argument. Move compat32 handling (and llseek) into the v4l2-dev core: this is now handled in the v4l2 core and no longer in the drivers themselves. Note that this changeset reverts an earlier patch that changed the return type of__video_ioctl2 from int to long. This change will be reinstated later in a much improved version. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c3
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c16
-rw-r--r--drivers/media/video/em28xx/em28xx.h2
3 files changed, 8 insertions, 13 deletions
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index f8504518586a..819cceaa6ef4 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -1000,12 +1000,11 @@ void em28xx_wake_i2c(struct em28xx *dev)
1000static LIST_HEAD(em28xx_devlist); 1000static LIST_HEAD(em28xx_devlist);
1001static DEFINE_MUTEX(em28xx_devlist_mutex); 1001static DEFINE_MUTEX(em28xx_devlist_mutex);
1002 1002
1003struct em28xx *em28xx_get_device(struct inode *inode, 1003struct em28xx *em28xx_get_device(int minor,
1004 enum v4l2_buf_type *fh_type, 1004 enum v4l2_buf_type *fh_type,
1005 int *has_radio) 1005 int *has_radio)
1006{ 1006{
1007 struct em28xx *h, *dev = NULL; 1007 struct em28xx *h, *dev = NULL;
1008 int minor = iminor(inode);
1009 1008
1010 *fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1009 *fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1011 *has_radio = 0; 1010 *has_radio = 0;
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 53527536481e..9cb7c64a88fa 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1582,15 +1582,15 @@ static int radio_queryctrl(struct file *file, void *priv,
1582 * em28xx_v4l2_open() 1582 * em28xx_v4l2_open()
1583 * inits the device and starts isoc transfer 1583 * inits the device and starts isoc transfer
1584 */ 1584 */
1585static int em28xx_v4l2_open(struct inode *inode, struct file *filp) 1585static int em28xx_v4l2_open(struct file *filp)
1586{ 1586{
1587 int minor = iminor(inode); 1587 int minor = video_devdata(filp)->minor;
1588 int errCode = 0, radio; 1588 int errCode = 0, radio;
1589 struct em28xx *dev; 1589 struct em28xx *dev;
1590 enum v4l2_buf_type fh_type; 1590 enum v4l2_buf_type fh_type;
1591 struct em28xx_fh *fh; 1591 struct em28xx_fh *fh;
1592 1592
1593 dev = em28xx_get_device(inode, &fh_type, &radio); 1593 dev = em28xx_get_device(minor, &fh_type, &radio);
1594 1594
1595 if (NULL == dev) 1595 if (NULL == dev)
1596 return -ENODEV; 1596 return -ENODEV;
@@ -1686,7 +1686,7 @@ void em28xx_release_analog_resources(struct em28xx *dev)
1686 * stops streaming and deallocates all resources allocated by the v4l2 1686 * stops streaming and deallocates all resources allocated by the v4l2
1687 * calls and ioctls 1687 * calls and ioctls
1688 */ 1688 */
1689static int em28xx_v4l2_close(struct inode *inode, struct file *filp) 1689static int em28xx_v4l2_close(struct file *filp)
1690{ 1690{
1691 struct em28xx_fh *fh = filp->private_data; 1691 struct em28xx_fh *fh = filp->private_data;
1692 struct em28xx *dev = fh->dev; 1692 struct em28xx *dev = fh->dev;
@@ -1826,7 +1826,7 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma)
1826 return rc; 1826 return rc;
1827} 1827}
1828 1828
1829static const struct file_operations em28xx_v4l_fops = { 1829static const struct v4l2_file_operations em28xx_v4l_fops = {
1830 .owner = THIS_MODULE, 1830 .owner = THIS_MODULE,
1831 .open = em28xx_v4l2_open, 1831 .open = em28xx_v4l2_open,
1832 .release = em28xx_v4l2_close, 1832 .release = em28xx_v4l2_close,
@@ -1834,8 +1834,6 @@ static const struct file_operations em28xx_v4l_fops = {
1834 .poll = em28xx_v4l2_poll, 1834 .poll = em28xx_v4l2_poll,
1835 .mmap = em28xx_v4l2_mmap, 1835 .mmap = em28xx_v4l2_mmap,
1836 .ioctl = video_ioctl2, 1836 .ioctl = video_ioctl2,
1837 .llseek = no_llseek,
1838 .compat_ioctl = v4l_compat_ioctl32,
1839}; 1837};
1840 1838
1841static const struct v4l2_ioctl_ops video_ioctl_ops = { 1839static const struct v4l2_ioctl_ops video_ioctl_ops = {
@@ -1890,13 +1888,11 @@ static const struct video_device em28xx_video_template = {
1890 .current_norm = V4L2_STD_PAL, 1888 .current_norm = V4L2_STD_PAL,
1891}; 1889};
1892 1890
1893static const struct file_operations radio_fops = { 1891static const struct v4l2_file_operations radio_fops = {
1894 .owner = THIS_MODULE, 1892 .owner = THIS_MODULE,
1895 .open = em28xx_v4l2_open, 1893 .open = em28xx_v4l2_open,
1896 .release = em28xx_v4l2_close, 1894 .release = em28xx_v4l2_close,
1897 .ioctl = video_ioctl2, 1895 .ioctl = video_ioctl2,
1898 .compat_ioctl = v4l_compat_ioctl32,
1899 .llseek = no_llseek,
1900}; 1896};
1901 1897
1902static const struct v4l2_ioctl_ops radio_ioctl_ops = { 1898static const struct v4l2_ioctl_ops radio_ioctl_ops = {
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index b5eddc26388e..afc5f6d17e0f 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -583,7 +583,7 @@ int em28xx_gpio_set(struct em28xx *dev, struct em28xx_reg_seq *gpio);
583void em28xx_wake_i2c(struct em28xx *dev); 583void em28xx_wake_i2c(struct em28xx *dev);
584void em28xx_remove_from_devlist(struct em28xx *dev); 584void em28xx_remove_from_devlist(struct em28xx *dev);
585void em28xx_add_into_devlist(struct em28xx *dev); 585void em28xx_add_into_devlist(struct em28xx *dev);
586struct em28xx *em28xx_get_device(struct inode *inode, 586struct em28xx *em28xx_get_device(int minor,
587 enum v4l2_buf_type *fh_type, 587 enum v4l2_buf_type *fh_type,
588 int *has_radio); 588 int *has_radio);
589int em28xx_register_extension(struct em28xx_ops *dev); 589int em28xx_register_extension(struct em28xx_ops *dev);