Commit 11f095aa authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] cx25821: remove 'type' field from cx25821_fh

Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent be178cb4
...@@ -506,24 +506,12 @@ static void cx25821_buffer_release(struct videobuf_queue *q, ...@@ -506,24 +506,12 @@ static void cx25821_buffer_release(struct videobuf_queue *q,
static struct videobuf_queue *get_queue(struct cx25821_fh *fh) static struct videobuf_queue *get_queue(struct cx25821_fh *fh)
{ {
switch (fh->type) { return &fh->vidq;
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
return &fh->vidq;
default:
BUG();
return NULL;
}
} }
static int cx25821_get_resource(struct cx25821_fh *fh, int resource) static int cx25821_get_resource(struct cx25821_fh *fh, int resource)
{ {
switch (fh->type) { return resource;
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
return resource;
default:
BUG();
return 0;
}
} }
static int cx25821_video_mmap(struct file *file, struct vm_area_struct *vma) static int cx25821_video_mmap(struct file *file, struct vm_area_struct *vma)
...@@ -605,7 +593,6 @@ static int video_open(struct file *file) ...@@ -605,7 +593,6 @@ static int video_open(struct file *file)
struct video_device *vdev = video_devdata(file); struct video_device *vdev = video_devdata(file);
struct cx25821_dev *dev = video_drvdata(file); struct cx25821_dev *dev = video_drvdata(file);
struct cx25821_fh *fh; struct cx25821_fh *fh;
enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
u32 pix_format; u32 pix_format;
int ch_id; int ch_id;
...@@ -624,7 +611,6 @@ static int video_open(struct file *file) ...@@ -624,7 +611,6 @@ static int video_open(struct file *file)
file->private_data = fh; file->private_data = fh;
fh->dev = dev; fh->dev = dev;
fh->type = type;
fh->width = 720; fh->width = 720;
fh->channel_id = ch_id; fh->channel_id = ch_id;
...@@ -659,22 +645,15 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count, ...@@ -659,22 +645,15 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count,
struct cx25821_dev *dev = fh->dev; struct cx25821_dev *dev = fh->dev;
int err; int err;
switch (fh->type) { if (mutex_lock_interruptible(&dev->lock))
case V4L2_BUF_TYPE_VIDEO_CAPTURE: return -ERESTARTSYS;
if (mutex_lock_interruptible(&dev->lock)) if (cx25821_res_locked(fh, RESOURCE_VIDEO0))
return -ERESTARTSYS; err = -EBUSY;
if (cx25821_res_locked(fh, RESOURCE_VIDEO0)) else
err = -EBUSY; err = videobuf_read_one(&fh->vidq, data, count, ppos,
else file->f_flags & O_NONBLOCK);
err = videobuf_read_one(&fh->vidq, data, count, ppos, mutex_unlock(&dev->lock);
file->f_flags & O_NONBLOCK); return err;
mutex_unlock(&dev->lock);
return err;
default:
return -ENODEV;
}
} }
static unsigned int video_poll(struct file *file, static 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,14 +797,11 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
struct cx25821_fh *fh = priv; struct cx25821_fh *fh = priv;
struct cx25821_dev *dev = fh->dev; struct cx25821_dev *dev = fh->dev;
if (unlikely(fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)) if (i != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
if (unlikely(i != fh->type))
return -EINVAL; return -EINVAL;
if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, if (!cx25821_res_get(dev, fh,
RESOURCE_VIDEO0)))) cx25821_get_resource(fh, RESOURCE_VIDEO0)))
return -EBUSY; return -EBUSY;
return videobuf_streamon(get_queue(fh)); 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,9 +813,7 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
struct cx25821_dev *dev = fh->dev; struct cx25821_dev *dev = fh->dev;
int err, res; int err, res;
if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) if (i != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
if (i != fh->type)
return -EINVAL; return -EINVAL;
res = cx25821_get_resource(fh, RESOURCE_VIDEO0); res = cx25821_get_resource(fh, RESOURCE_VIDEO0);
......
...@@ -118,7 +118,6 @@ struct cx25821_tvnorm { ...@@ -118,7 +118,6 @@ struct cx25821_tvnorm {
struct cx25821_fh { struct cx25821_fh {
struct cx25821_dev *dev; struct cx25821_dev *dev;
enum v4l2_buf_type type;
u32 resources; u32 resources;
enum v4l2_priority prio; enum v4l2_priority prio;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment