[media] saa7146: remove the unneeded type field from saa7146_fh
authorHans Verkuil <hans.verkuil@cisco.com>
Tue, 1 May 2012 14:39:08 +0000 (11:39 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 14 May 2012 17:58:57 +0000 (14:58 -0300)
This information can also be retrieved from struct video_device.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/common/saa7146_fops.c
include/media/saa7146_vv.h

index 776dfc35be57619df8aacb3267a4ce6a5db6d79f..66f6e79dd97bc3cc508c1fd6ad72a1faa518d897 100644 (file)
@@ -229,9 +229,8 @@ static int fops_open(struct file *file)
 
        file->private_data = fh;
        fh->dev = dev;
-       fh->type = type;
 
-       if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
+       if (vdev->vfl_type == VFL_TYPE_VBI) {
                DEB_S("initializing vbi...\n");
                if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE)
                        result = saa7146_vbi_uops.open(dev,file);
@@ -263,6 +262,7 @@ out:
 
 static int fops_release(struct file *file)
 {
+       struct video_device *vdev = video_devdata(file);
        struct saa7146_fh  *fh  = file->private_data;
        struct saa7146_dev *dev = fh->dev;
 
@@ -271,7 +271,7 @@ static int fops_release(struct file *file)
        if (mutex_lock_interruptible(&saa7146_devices_lock))
                return -ERESTARTSYS;
 
-       if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
+       if (vdev->vfl_type == VFL_TYPE_VBI) {
                if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE)
                        saa7146_vbi_uops.release(dev,file);
                if (dev->ext_vv_data->vbi_fops.release)
@@ -291,17 +291,18 @@ static int fops_release(struct file *file)
 
 static int fops_mmap(struct file *file, struct vm_area_struct * vma)
 {
+       struct video_device *vdev = video_devdata(file);
        struct saa7146_fh *fh = file->private_data;
        struct videobuf_queue *q;
 
-       switch (fh->type) {
-       case V4L2_BUF_TYPE_VIDEO_CAPTURE: {
+       switch (vdev->vfl_type) {
+       case VFL_TYPE_GRABBER: {
                DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, vma:%p\n",
                       file, vma);
                q = &fh->video_q;
                break;
                }
-       case V4L2_BUF_TYPE_VBI_CAPTURE: {
+       case VFL_TYPE_VBI: {
                DEB_EE("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, vma:%p\n",
                       file, vma);
                q = &fh->vbi_q;
@@ -317,13 +318,14 @@ static int fops_mmap(struct file *file, struct vm_area_struct * vma)
 
 static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait)
 {
+       struct video_device *vdev = video_devdata(file);
        struct saa7146_fh *fh = file->private_data;
        struct videobuf_buffer *buf = NULL;
        struct videobuf_queue *q;
 
        DEB_EE("file:%p, poll:%p\n", file, wait);
 
-       if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) {
+       if (vdev->vfl_type == VFL_TYPE_VBI) {
                if( 0 == fh->vbi_q.streaming )
                        return videobuf_poll_stream(file, &fh->vbi_q, wait);
                q = &fh->vbi_q;
@@ -352,16 +354,17 @@ static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait)
 
 static ssize_t fops_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
 {
+       struct video_device *vdev = video_devdata(file);
        struct saa7146_fh *fh = file->private_data;
 
-       switch (fh->type) {
-       case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+       switch (vdev->vfl_type) {
+       case VFL_TYPE_GRABBER:
 /*
                DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, data:%p, count:%lun",
                       file, data, (unsigned long)count);
 */
                return saa7146_video_uops.read(file,data,count,ppos);
-       case V4L2_BUF_TYPE_VBI_CAPTURE:
+       case VFL_TYPE_VBI:
 /*
                DEB_EE("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, data:%p, count:%lu\n",
                       file, data, (unsigned long)count);
@@ -377,12 +380,13 @@ static ssize_t fops_read(struct file *file, char __user *data, size_t count, lof
 
 static ssize_t fops_write(struct file *file, const char __user *data, size_t count, loff_t *ppos)
 {
+       struct video_device *vdev = video_devdata(file);
        struct saa7146_fh *fh = file->private_data;
 
-       switch (fh->type) {
-       case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+       switch (vdev->vfl_type) {
+       case VFL_TYPE_GRABBER:
                return -EINVAL;
-       case V4L2_BUF_TYPE_VBI_CAPTURE:
+       case VFL_TYPE_VBI:
                if (fh->dev->ext_vv_data->vbi_fops.write)
                        return fh->dev->ext_vv_data->vbi_fops.write(file, data, count, ppos);
                else
index 658ae8361d5e20883a937b6cd633469ab836ce74..e9f434c74072b987f428542b6d0b9da3c69db84b 100644 (file)
@@ -85,8 +85,6 @@ struct saa7146_overlay {
 /* per open data */
 struct saa7146_fh {
        struct saa7146_dev      *dev;
-       /* if this is a vbi or capture open */
-       enum v4l2_buf_type      type;
 
        /* video capture */
        struct videobuf_queue   video_q;