diff options
-rw-r--r-- | drivers/media/common/saa7146_fops.c | 30 | ||||
-rw-r--r-- | include/media/saa7146_vv.h | 2 |
2 files changed, 17 insertions, 15 deletions
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index 776dfc35be57..66f6e79dd97b 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c | |||
@@ -229,9 +229,8 @@ static int fops_open(struct file *file) | |||
229 | 229 | ||
230 | file->private_data = fh; | 230 | file->private_data = fh; |
231 | fh->dev = dev; | 231 | fh->dev = dev; |
232 | fh->type = type; | ||
233 | 232 | ||
234 | if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { | 233 | if (vdev->vfl_type == VFL_TYPE_VBI) { |
235 | DEB_S("initializing vbi...\n"); | 234 | DEB_S("initializing vbi...\n"); |
236 | if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) | 235 | if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) |
237 | result = saa7146_vbi_uops.open(dev,file); | 236 | result = saa7146_vbi_uops.open(dev,file); |
@@ -263,6 +262,7 @@ out: | |||
263 | 262 | ||
264 | static int fops_release(struct file *file) | 263 | static int fops_release(struct file *file) |
265 | { | 264 | { |
265 | struct video_device *vdev = video_devdata(file); | ||
266 | struct saa7146_fh *fh = file->private_data; | 266 | struct saa7146_fh *fh = file->private_data; |
267 | struct saa7146_dev *dev = fh->dev; | 267 | struct saa7146_dev *dev = fh->dev; |
268 | 268 | ||
@@ -271,7 +271,7 @@ static int fops_release(struct file *file) | |||
271 | if (mutex_lock_interruptible(&saa7146_devices_lock)) | 271 | if (mutex_lock_interruptible(&saa7146_devices_lock)) |
272 | return -ERESTARTSYS; | 272 | return -ERESTARTSYS; |
273 | 273 | ||
274 | if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { | 274 | if (vdev->vfl_type == VFL_TYPE_VBI) { |
275 | if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) | 275 | if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) |
276 | saa7146_vbi_uops.release(dev,file); | 276 | saa7146_vbi_uops.release(dev,file); |
277 | if (dev->ext_vv_data->vbi_fops.release) | 277 | if (dev->ext_vv_data->vbi_fops.release) |
@@ -291,17 +291,18 @@ static int fops_release(struct file *file) | |||
291 | 291 | ||
292 | static int fops_mmap(struct file *file, struct vm_area_struct * vma) | 292 | static int fops_mmap(struct file *file, struct vm_area_struct * vma) |
293 | { | 293 | { |
294 | struct video_device *vdev = video_devdata(file); | ||
294 | struct saa7146_fh *fh = file->private_data; | 295 | struct saa7146_fh *fh = file->private_data; |
295 | struct videobuf_queue *q; | 296 | struct videobuf_queue *q; |
296 | 297 | ||
297 | switch (fh->type) { | 298 | switch (vdev->vfl_type) { |
298 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: { | 299 | case VFL_TYPE_GRABBER: { |
299 | DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, vma:%p\n", | 300 | DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, vma:%p\n", |
300 | file, vma); | 301 | file, vma); |
301 | q = &fh->video_q; | 302 | q = &fh->video_q; |
302 | break; | 303 | break; |
303 | } | 304 | } |
304 | case V4L2_BUF_TYPE_VBI_CAPTURE: { | 305 | case VFL_TYPE_VBI: { |
305 | DEB_EE("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, vma:%p\n", | 306 | DEB_EE("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, vma:%p\n", |
306 | file, vma); | 307 | file, vma); |
307 | q = &fh->vbi_q; | 308 | q = &fh->vbi_q; |
@@ -317,13 +318,14 @@ static int fops_mmap(struct file *file, struct vm_area_struct * vma) | |||
317 | 318 | ||
318 | static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait) | 319 | static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait) |
319 | { | 320 | { |
321 | struct video_device *vdev = video_devdata(file); | ||
320 | struct saa7146_fh *fh = file->private_data; | 322 | struct saa7146_fh *fh = file->private_data; |
321 | struct videobuf_buffer *buf = NULL; | 323 | struct videobuf_buffer *buf = NULL; |
322 | struct videobuf_queue *q; | 324 | struct videobuf_queue *q; |
323 | 325 | ||
324 | DEB_EE("file:%p, poll:%p\n", file, wait); | 326 | DEB_EE("file:%p, poll:%p\n", file, wait); |
325 | 327 | ||
326 | if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { | 328 | if (vdev->vfl_type == VFL_TYPE_VBI) { |
327 | if( 0 == fh->vbi_q.streaming ) | 329 | if( 0 == fh->vbi_q.streaming ) |
328 | return videobuf_poll_stream(file, &fh->vbi_q, wait); | 330 | return videobuf_poll_stream(file, &fh->vbi_q, wait); |
329 | q = &fh->vbi_q; | 331 | q = &fh->vbi_q; |
@@ -352,16 +354,17 @@ static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait) | |||
352 | 354 | ||
353 | static ssize_t fops_read(struct file *file, char __user *data, size_t count, loff_t *ppos) | 355 | static ssize_t fops_read(struct file *file, char __user *data, size_t count, loff_t *ppos) |
354 | { | 356 | { |
357 | struct video_device *vdev = video_devdata(file); | ||
355 | struct saa7146_fh *fh = file->private_data; | 358 | struct saa7146_fh *fh = file->private_data; |
356 | 359 | ||
357 | switch (fh->type) { | 360 | switch (vdev->vfl_type) { |
358 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 361 | case VFL_TYPE_GRABBER: |
359 | /* | 362 | /* |
360 | DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, data:%p, count:%lun", | 363 | DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, data:%p, count:%lun", |
361 | file, data, (unsigned long)count); | 364 | file, data, (unsigned long)count); |
362 | */ | 365 | */ |
363 | return saa7146_video_uops.read(file,data,count,ppos); | 366 | return saa7146_video_uops.read(file,data,count,ppos); |
364 | case V4L2_BUF_TYPE_VBI_CAPTURE: | 367 | case VFL_TYPE_VBI: |
365 | /* | 368 | /* |
366 | DEB_EE("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, data:%p, count:%lu\n", | 369 | DEB_EE("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, data:%p, count:%lu\n", |
367 | file, data, (unsigned long)count); | 370 | file, data, (unsigned long)count); |
@@ -377,12 +380,13 @@ static ssize_t fops_read(struct file *file, char __user *data, size_t count, lof | |||
377 | 380 | ||
378 | static ssize_t fops_write(struct file *file, const char __user *data, size_t count, loff_t *ppos) | 381 | static ssize_t fops_write(struct file *file, const char __user *data, size_t count, loff_t *ppos) |
379 | { | 382 | { |
383 | struct video_device *vdev = video_devdata(file); | ||
380 | struct saa7146_fh *fh = file->private_data; | 384 | struct saa7146_fh *fh = file->private_data; |
381 | 385 | ||
382 | switch (fh->type) { | 386 | switch (vdev->vfl_type) { |
383 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 387 | case VFL_TYPE_GRABBER: |
384 | return -EINVAL; | 388 | return -EINVAL; |
385 | case V4L2_BUF_TYPE_VBI_CAPTURE: | 389 | case VFL_TYPE_VBI: |
386 | if (fh->dev->ext_vv_data->vbi_fops.write) | 390 | if (fh->dev->ext_vv_data->vbi_fops.write) |
387 | return fh->dev->ext_vv_data->vbi_fops.write(file, data, count, ppos); | 391 | return fh->dev->ext_vv_data->vbi_fops.write(file, data, count, ppos); |
388 | else | 392 | else |
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h index 658ae8361d5e..e9f434c74072 100644 --- a/include/media/saa7146_vv.h +++ b/include/media/saa7146_vv.h | |||
@@ -85,8 +85,6 @@ struct saa7146_overlay { | |||
85 | /* per open data */ | 85 | /* per open data */ |
86 | struct saa7146_fh { | 86 | struct saa7146_fh { |
87 | struct saa7146_dev *dev; | 87 | struct saa7146_dev *dev; |
88 | /* if this is a vbi or capture open */ | ||
89 | enum v4l2_buf_type type; | ||
90 | 88 | ||
91 | /* video capture */ | 89 | /* video capture */ |
92 | struct videobuf_queue video_q; | 90 | struct videobuf_queue video_q; |