aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-04-14 10:54:56 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-16 17:05:49 -0400
commit11f095aa4154d27bdb15909b12a9d3922ab55cde (patch)
treef3c9b426316c0614c758c4db74bb9a1e6bb840c9
parentbe178cb4f41f70e29108ce4eb5a8a77a62f1922f (diff)
[media] cx25821: remove 'type' field from cx25821_fh
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/pci/cx25821/cx25821-video.c56
-rw-r--r--drivers/media/pci/cx25821/cx25821.h1
2 files changed, 15 insertions, 42 deletions
diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c
index ab79bd5e5f68..2aba24f2a3d8 100644
--- a/drivers/media/pci/cx25821/cx25821-video.c
+++ b/drivers/media/pci/cx25821/cx25821-video.c
@@ -506,24 +506,12 @@ static void cx25821_buffer_release(struct videobuf_queue *q,
506 506
507static struct videobuf_queue *get_queue(struct cx25821_fh *fh) 507static struct videobuf_queue *get_queue(struct cx25821_fh *fh)
508{ 508{
509 switch (fh->type) { 509 return &fh->vidq;
510 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
511 return &fh->vidq;
512 default:
513 BUG();
514 return NULL;
515 }
516} 510}
517 511
518static int cx25821_get_resource(struct cx25821_fh *fh, int resource) 512static int cx25821_get_resource(struct cx25821_fh *fh, int resource)
519{ 513{
520 switch (fh->type) { 514 return resource;
521 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
522 return resource;
523 default:
524 BUG();
525 return 0;
526 }
527} 515}
528 516
529static int cx25821_video_mmap(struct file *file, struct vm_area_struct *vma) 517static int cx25821_video_mmap(struct file *file, struct vm_area_struct *vma)
@@ -605,7 +593,6 @@ static int video_open(struct file *file)
605 struct video_device *vdev = video_devdata(file); 593 struct video_device *vdev = video_devdata(file);
606 struct cx25821_dev *dev = video_drvdata(file); 594 struct cx25821_dev *dev = video_drvdata(file);
607 struct cx25821_fh *fh; 595 struct cx25821_fh *fh;
608 enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
609 u32 pix_format; 596 u32 pix_format;
610 int ch_id; 597 int ch_id;
611 598
@@ -624,7 +611,6 @@ static int video_open(struct file *file)
624 611
625 file->private_data = fh; 612 file->private_data = fh;
626 fh->dev = dev; 613 fh->dev = dev;
627 fh->type = type;
628 fh->width = 720; 614 fh->width = 720;
629 fh->channel_id = ch_id; 615 fh->channel_id = ch_id;
630 616
@@ -659,22 +645,15 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count,
659 struct cx25821_dev *dev = fh->dev; 645 struct cx25821_dev *dev = fh->dev;
660 int err; 646 int err;
661 647
662 switch (fh->type) { 648 if (mutex_lock_interruptible(&dev->lock))
663 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 649 return -ERESTARTSYS;
664 if (mutex_lock_interruptible(&dev->lock)) 650 if (cx25821_res_locked(fh, RESOURCE_VIDEO0))
665 return -ERESTARTSYS; 651 err = -EBUSY;
666 if (cx25821_res_locked(fh, RESOURCE_VIDEO0)) 652 else
667 err = -EBUSY; 653 err = videobuf_read_one(&fh->vidq, data, count, ppos,
668 else 654 file->f_flags & O_NONBLOCK);
669 err = videobuf_read_one(&fh->vidq, data, count, ppos, 655 mutex_unlock(&dev->lock);
670 file->f_flags & O_NONBLOCK); 656 return err;
671 mutex_unlock(&dev->lock);
672 return err;
673
674 default:
675 return -ENODEV;
676 }
677
678} 657}
679 658
680static unsigned int video_poll(struct file *file, 659static unsigned int video_poll(struct file *file,
@@ -818,14 +797,11 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
818 struct cx25821_fh *fh = priv; 797 struct cx25821_fh *fh = priv;
819 struct cx25821_dev *dev = fh->dev; 798 struct cx25821_dev *dev = fh->dev;
820 799
821 if (unlikely(fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)) 800 if (i != V4L2_BUF_TYPE_VIDEO_CAPTURE)
822 return -EINVAL;
823
824 if (unlikely(i != fh->type))
825 return -EINVAL; 801 return -EINVAL;
826 802
827 if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, 803 if (!cx25821_res_get(dev, fh,
828 RESOURCE_VIDEO0)))) 804 cx25821_get_resource(fh, RESOURCE_VIDEO0)))
829 return -EBUSY; 805 return -EBUSY;
830 806
831 return videobuf_streamon(get_queue(fh)); 807 return videobuf_streamon(get_queue(fh));
@@ -837,9 +813,7 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
837 struct cx25821_dev *dev = fh->dev; 813 struct cx25821_dev *dev = fh->dev;
838 int err, res; 814 int err, res;
839 815
840 if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 816 if (i != V4L2_BUF_TYPE_VIDEO_CAPTURE)
841 return -EINVAL;
842 if (i != fh->type)
843 return -EINVAL; 817 return -EINVAL;
844 818
845 res = cx25821_get_resource(fh, RESOURCE_VIDEO0); 819 res = cx25821_get_resource(fh, RESOURCE_VIDEO0);
diff --git a/drivers/media/pci/cx25821/cx25821.h b/drivers/media/pci/cx25821/cx25821.h
index ad56232154e6..d1c91c9e911a 100644
--- a/drivers/media/pci/cx25821/cx25821.h
+++ b/drivers/media/pci/cx25821/cx25821.h
@@ -118,7 +118,6 @@ struct cx25821_tvnorm {
118 118
119struct cx25821_fh { 119struct cx25821_fh {
120 struct cx25821_dev *dev; 120 struct cx25821_dev *dev;
121 enum v4l2_buf_type type;
122 u32 resources; 121 u32 resources;
123 122
124 enum v4l2_priority prio; 123 enum v4l2_priority prio;