diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-03-10 10:29:15 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-03-24 14:26:49 -0500 |
commit | c7b0ac0546985fc6361a8d92cf808d46da797677 (patch) | |
tree | 2147eb2f6dd7b2b82e0d7b4b9a26e12ef5193252 /drivers/media/video/cx88/cx88-video.c | |
parent | b2fd16b4ff2508ac16ae994f4bcd941f97754c00 (diff) |
V4L/DVB (3516): Make video_buf more generic
Video_buf were concerned to allow PCI devices to be used as
video capture devices. This patch extends video_buf features
by virtualizing pci-dependent functions and allowing other
type of devices to use it.
It is still DMA centric, although it may be used also by
devices that emulates scatter/gather behavior or a DMA device
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cx88/cx88-video.c')
-rw-r--r-- | drivers/media/video/cx88/cx88-video.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 6c97aa740d27..72a417b31745 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -564,7 +564,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
564 | 564 | ||
565 | if (STATE_NEEDS_INIT == buf->vb.state) { | 565 | if (STATE_NEEDS_INIT == buf->vb.state) { |
566 | init_buffer = 1; | 566 | init_buffer = 1; |
567 | if (0 != (rc = videobuf_iolock(dev->pci,&buf->vb,NULL))) | 567 | if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL))) |
568 | goto fail; | 568 | goto fail; |
569 | } | 569 | } |
570 | 570 | ||
@@ -614,7 +614,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
614 | return 0; | 614 | return 0; |
615 | 615 | ||
616 | fail: | 616 | fail: |
617 | cx88_free_buffer(dev->pci,buf); | 617 | cx88_free_buffer(q,buf); |
618 | return rc; | 618 | return rc; |
619 | } | 619 | } |
620 | 620 | ||
@@ -671,9 +671,8 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) | |||
671 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | 671 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) |
672 | { | 672 | { |
673 | struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); | 673 | struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); |
674 | struct cx8800_fh *fh = q->priv_data; | ||
675 | 674 | ||
676 | cx88_free_buffer(fh->dev->pci,buf); | 675 | cx88_free_buffer(q,buf); |
677 | } | 676 | } |
678 | 677 | ||
679 | static struct videobuf_queue_ops cx8800_video_qops = { | 678 | static struct videobuf_queue_ops cx8800_video_qops = { |
@@ -1251,9 +1250,17 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, | |||
1251 | { | 1250 | { |
1252 | int err; | 1251 | int err; |
1253 | 1252 | ||
1254 | dprintk(2, "CORE IOCTL: 0x%x\n", cmd ); | 1253 | if (video_debug) { |
1255 | if (video_debug > 1) | 1254 | if (video_debug > 1) { |
1256 | v4l_print_ioctl(core->name,cmd); | 1255 | if (_IOC_DIR(cmd) & _IOC_WRITE) |
1256 | v4l_printk_ioctl_arg("cx88(w)",cmd, arg); | ||
1257 | else if (!_IOC_DIR(cmd) & _IOC_READ) { | ||
1258 | v4l_print_ioctl("cx88", cmd); | ||
1259 | } | ||
1260 | } else | ||
1261 | v4l_print_ioctl(core->name,cmd); | ||
1262 | |||
1263 | } | ||
1257 | 1264 | ||
1258 | switch (cmd) { | 1265 | switch (cmd) { |
1259 | /* ---------- tv norms ---------- */ | 1266 | /* ---------- tv norms ---------- */ |
@@ -1460,7 +1467,19 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, | |||
1460 | static int video_ioctl(struct inode *inode, struct file *file, | 1467 | static int video_ioctl(struct inode *inode, struct file *file, |
1461 | unsigned int cmd, unsigned long arg) | 1468 | unsigned int cmd, unsigned long arg) |
1462 | { | 1469 | { |
1463 | return video_usercopy(inode, file, cmd, arg, video_do_ioctl); | 1470 | int retval; |
1471 | |||
1472 | retval=video_usercopy(inode, file, cmd, arg, video_do_ioctl); | ||
1473 | |||
1474 | if (video_debug > 1) { | ||
1475 | if (retval < 0) { | ||
1476 | v4l_print_ioctl("cx88(err)", cmd); | ||
1477 | printk(KERN_DEBUG "cx88(err): errcode=%d\n",retval); | ||
1478 | } else if (_IOC_DIR(cmd) & _IOC_READ) | ||
1479 | v4l_printk_ioctl_arg("cx88(r)",cmd, (void *)arg); | ||
1480 | } | ||
1481 | |||
1482 | return retval; | ||
1464 | } | 1483 | } |
1465 | 1484 | ||
1466 | /* ----------------------------------------------------------- */ | 1485 | /* ----------------------------------------------------------- */ |