diff options
author | Guennadi Liakhovetski <g.liakhovetski@pengutronix.de> | 2008-04-22 13:42:13 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:07:44 -0400 |
commit | 0705135e59f8503e4dade4b3580fed77b1743b7c (patch) | |
tree | 9ab28abeff6cb8ffa50e565204ed4394524d28d7 /drivers | |
parent | f13613acfb1a71895ac886dc831d6ae4e20e241a (diff) |
V4L/DVB (7237): Convert videobuf-dma-sg to generic DMA API
videobuf-dma-sg does not need to depend on PCI. Switch it to using generic
DMA API, convert all affected drivers, relax Kconfig restriction, improve
compile-time type checking, fix some Coding Style violations while at it.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/Kconfig | 2 | ||||
-rw-r--r-- | drivers/media/common/saa7146_vbi.c | 4 | ||||
-rw-r--r-- | drivers/media/common/saa7146_video.c | 4 | ||||
-rw-r--r-- | drivers/media/video/bt8xx/bttv-driver.c | 16 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-dvb.c | 2 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-video.c | 4 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-alsa.c | 8 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-blackbird.c | 4 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-dvb.c | 4 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-video.c | 8 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-alsa.c | 10 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-dvb.c | 4 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-empress.c | 4 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-video.c | 8 | ||||
-rw-r--r-- | drivers/media/video/soc_camera.c | 2 | ||||
-rw-r--r-- | drivers/media/video/videobuf-dma-sg.c | 117 | ||||
-rw-r--r-- | drivers/media/video/videobuf-vmalloc.c | 2 |
17 files changed, 102 insertions, 101 deletions
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index a86504587447..b9b38d9ff650 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig | |||
@@ -160,7 +160,7 @@ config VIDEOBUF_GEN | |||
160 | tristate | 160 | tristate |
161 | 161 | ||
162 | config VIDEOBUF_DMA_SG | 162 | config VIDEOBUF_DMA_SG |
163 | depends on PCI || ARCH_PXA | 163 | depends on HAS_DMA |
164 | select VIDEOBUF_GEN | 164 | select VIDEOBUF_GEN |
165 | tristate | 165 | tristate |
166 | 166 | ||
diff --git a/drivers/media/common/saa7146_vbi.c b/drivers/media/common/saa7146_vbi.c index bfbd5a841ebf..74e2b56ecb5b 100644 --- a/drivers/media/common/saa7146_vbi.c +++ b/drivers/media/common/saa7146_vbi.c | |||
@@ -407,8 +407,8 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file) | |||
407 | fh->vbi_fmt.start[1] = 312; | 407 | fh->vbi_fmt.start[1] = 312; |
408 | fh->vbi_fmt.count[1] = 16; | 408 | fh->vbi_fmt.count[1] = 16; |
409 | 409 | ||
410 | videobuf_queue_pci_init(&fh->vbi_q, &vbi_qops, | 410 | videobuf_queue_sg_init(&fh->vbi_q, &vbi_qops, |
411 | dev->pci, &dev->slock, | 411 | &dev->pci->dev, &dev->slock, |
412 | V4L2_BUF_TYPE_VBI_CAPTURE, | 412 | V4L2_BUF_TYPE_VBI_CAPTURE, |
413 | V4L2_FIELD_SEQ_TB, // FIXME: does this really work? | 413 | V4L2_FIELD_SEQ_TB, // FIXME: does this really work? |
414 | sizeof(struct saa7146_buf), | 414 | sizeof(struct saa7146_buf), |
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index 66fdbd0e6a6d..3cbc6ebbe649 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c | |||
@@ -1410,8 +1410,8 @@ static int video_open(struct saa7146_dev *dev, struct file *file) | |||
1410 | sfmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); | 1410 | sfmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); |
1411 | fh->video_fmt.sizeimage = (fh->video_fmt.width * fh->video_fmt.height * sfmt->depth)/8; | 1411 | fh->video_fmt.sizeimage = (fh->video_fmt.width * fh->video_fmt.height * sfmt->depth)/8; |
1412 | 1412 | ||
1413 | videobuf_queue_pci_init(&fh->video_q, &video_qops, | 1413 | videobuf_queue_sg_init(&fh->video_q, &video_qops, |
1414 | dev->pci, &dev->slock, | 1414 | &dev->pci->dev, &dev->slock, |
1415 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 1415 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
1416 | V4L2_FIELD_INTERLACED, | 1416 | V4L2_FIELD_INTERLACED, |
1417 | sizeof(struct saa7146_buf), | 1417 | sizeof(struct saa7146_buf), |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index fcf8f2d208a8..af2c0c994186 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -2372,7 +2372,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv, | |||
2372 | if (check_btres(fh, RESOURCE_OVERLAY)) { | 2372 | if (check_btres(fh, RESOURCE_OVERLAY)) { |
2373 | struct bttv_buffer *new; | 2373 | struct bttv_buffer *new; |
2374 | 2374 | ||
2375 | new = videobuf_pci_alloc(sizeof(*new)); | 2375 | new = videobuf_sg_alloc(sizeof(*new)); |
2376 | new->crop = btv->crop[!!fh->do_crop].rect; | 2376 | new->crop = btv->crop[!!fh->do_crop].rect; |
2377 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); | 2377 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); |
2378 | retval = bttv_switch_overlay(btv,fh,new); | 2378 | retval = bttv_switch_overlay(btv,fh,new); |
@@ -2760,7 +2760,7 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on) | |||
2760 | mutex_lock(&fh->cap.vb_lock); | 2760 | mutex_lock(&fh->cap.vb_lock); |
2761 | if (on) { | 2761 | if (on) { |
2762 | fh->ov.tvnorm = btv->tvnorm; | 2762 | fh->ov.tvnorm = btv->tvnorm; |
2763 | new = videobuf_pci_alloc(sizeof(*new)); | 2763 | new = videobuf_sg_alloc(sizeof(*new)); |
2764 | new->crop = btv->crop[!!fh->do_crop].rect; | 2764 | new->crop = btv->crop[!!fh->do_crop].rect; |
2765 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); | 2765 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); |
2766 | } else { | 2766 | } else { |
@@ -2834,7 +2834,7 @@ static int bttv_s_fbuf(struct file *file, void *f, | |||
2834 | if (check_btres(fh, RESOURCE_OVERLAY)) { | 2834 | if (check_btres(fh, RESOURCE_OVERLAY)) { |
2835 | struct bttv_buffer *new; | 2835 | struct bttv_buffer *new; |
2836 | 2836 | ||
2837 | new = videobuf_pci_alloc(sizeof(*new)); | 2837 | new = videobuf_sg_alloc(sizeof(*new)); |
2838 | new->crop = btv->crop[!!fh->do_crop].rect; | 2838 | new->crop = btv->crop[!!fh->do_crop].rect; |
2839 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); | 2839 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); |
2840 | retval = bttv_switch_overlay(btv, fh, new); | 2840 | retval = bttv_switch_overlay(btv, fh, new); |
@@ -3184,7 +3184,7 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) | |||
3184 | /* need to capture a new frame */ | 3184 | /* need to capture a new frame */ |
3185 | if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM)) | 3185 | if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM)) |
3186 | goto err; | 3186 | goto err; |
3187 | fh->cap.read_buf = videobuf_pci_alloc(fh->cap.msize); | 3187 | fh->cap.read_buf = videobuf_sg_alloc(fh->cap.msize); |
3188 | if (NULL == fh->cap.read_buf) | 3188 | if (NULL == fh->cap.read_buf) |
3189 | goto err; | 3189 | goto err; |
3190 | fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; | 3190 | fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; |
@@ -3251,14 +3251,14 @@ static int bttv_open(struct inode *inode, struct file *file) | |||
3251 | fh->ov.setup_ok = 0; | 3251 | fh->ov.setup_ok = 0; |
3252 | v4l2_prio_open(&btv->prio,&fh->prio); | 3252 | v4l2_prio_open(&btv->prio,&fh->prio); |
3253 | 3253 | ||
3254 | videobuf_queue_pci_init(&fh->cap, &bttv_video_qops, | 3254 | videobuf_queue_sg_init(&fh->cap, &bttv_video_qops, |
3255 | btv->c.pci, &btv->s_lock, | 3255 | &btv->c.pci->dev, &btv->s_lock, |
3256 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 3256 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
3257 | V4L2_FIELD_INTERLACED, | 3257 | V4L2_FIELD_INTERLACED, |
3258 | sizeof(struct bttv_buffer), | 3258 | sizeof(struct bttv_buffer), |
3259 | fh); | 3259 | fh); |
3260 | videobuf_queue_pci_init(&fh->vbi, &bttv_vbi_qops, | 3260 | videobuf_queue_sg_init(&fh->vbi, &bttv_vbi_qops, |
3261 | btv->c.pci, &btv->s_lock, | 3261 | &btv->c.pci->dev, &btv->s_lock, |
3262 | V4L2_BUF_TYPE_VBI_CAPTURE, | 3262 | V4L2_BUF_TYPE_VBI_CAPTURE, |
3263 | V4L2_FIELD_SEQ_TB, | 3263 | V4L2_FIELD_SEQ_TB, |
3264 | sizeof(struct bttv_buffer), | 3264 | sizeof(struct bttv_buffer), |
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c index ed465c007cea..6c21779852fb 100644 --- a/drivers/media/video/cx23885/cx23885-dvb.c +++ b/drivers/media/video/cx23885/cx23885-dvb.c | |||
@@ -349,7 +349,7 @@ int cx23885_dvb_register(struct cx23885_tsport *port) | |||
349 | 349 | ||
350 | /* dvb stuff */ | 350 | /* dvb stuff */ |
351 | printk("%s: cx23885 based dvb card\n", dev->name); | 351 | printk("%s: cx23885 based dvb card\n", dev->name); |
352 | videobuf_queue_pci_init(&port->dvb.dvbq, &dvb_qops, dev->pci, &port->slock, | 352 | videobuf_queue_sg_init(&port->dvb.dvbq, &dvb_qops, &dev->pci->dev, &port->slock, |
353 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_TOP, | 353 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_TOP, |
354 | sizeof(struct cx23885_buffer), port); | 354 | sizeof(struct cx23885_buffer), port); |
355 | err = dvb_register(port); | 355 | err = dvb_register(port); |
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index d3c4d2c5cbe0..45bf2146a193 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
@@ -765,8 +765,8 @@ static int video_open(struct inode *inode, struct file *file) | |||
765 | fh->height = 240; | 765 | fh->height = 240; |
766 | fh->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24); | 766 | fh->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24); |
767 | 767 | ||
768 | videobuf_queue_pci_init(&fh->vidq, &cx23885_video_qops, | 768 | videobuf_queue_sg_init(&fh->vidq, &cx23885_video_qops, |
769 | dev->pci, &dev->slock, | 769 | &dev->pci->dev, &dev->slock, |
770 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 770 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
771 | V4L2_FIELD_INTERLACED, | 771 | V4L2_FIELD_INTERLACED, |
772 | sizeof(struct cx23885_buffer), | 772 | sizeof(struct cx23885_buffer), |
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index 316b106c3511..2f5a4a4ba407 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c | |||
@@ -283,7 +283,7 @@ static int dsp_buffer_free(snd_cx88_card_t *chip) | |||
283 | BUG_ON(!chip->dma_size); | 283 | BUG_ON(!chip->dma_size); |
284 | 284 | ||
285 | dprintk(2,"Freeing buffer\n"); | 285 | dprintk(2,"Freeing buffer\n"); |
286 | videobuf_pci_dma_unmap(chip->pci, chip->dma_risc); | 286 | videobuf_sg_dma_unmap(&chip->pci->dev, chip->dma_risc); |
287 | videobuf_dma_free(chip->dma_risc); | 287 | videobuf_dma_free(chip->dma_risc); |
288 | btcx_riscmem_free(chip->pci,&chip->buf->risc); | 288 | btcx_riscmem_free(chip->pci,&chip->buf->risc); |
289 | kfree(chip->buf); | 289 | kfree(chip->buf); |
@@ -385,7 +385,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream, | |||
385 | BUG_ON(!chip->dma_size); | 385 | BUG_ON(!chip->dma_size); |
386 | BUG_ON(chip->num_periods & (chip->num_periods-1)); | 386 | BUG_ON(chip->num_periods & (chip->num_periods-1)); |
387 | 387 | ||
388 | buf = videobuf_pci_alloc(sizeof(*buf)); | 388 | buf = videobuf_sg_alloc(sizeof(*buf)); |
389 | if (NULL == buf) | 389 | if (NULL == buf) |
390 | return -ENOMEM; | 390 | return -ENOMEM; |
391 | 391 | ||
@@ -396,14 +396,14 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream, | |||
396 | buf->vb.height = chip->num_periods; | 396 | buf->vb.height = chip->num_periods; |
397 | buf->vb.size = chip->dma_size; | 397 | buf->vb.size = chip->dma_size; |
398 | 398 | ||
399 | dma=videobuf_to_dma(&buf->vb); | 399 | dma = videobuf_to_dma(&buf->vb); |
400 | videobuf_dma_init(dma); | 400 | videobuf_dma_init(dma); |
401 | ret = videobuf_dma_init_kernel(dma, PCI_DMA_FROMDEVICE, | 401 | ret = videobuf_dma_init_kernel(dma, PCI_DMA_FROMDEVICE, |
402 | (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT)); | 402 | (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT)); |
403 | if (ret < 0) | 403 | if (ret < 0) |
404 | goto error; | 404 | goto error; |
405 | 405 | ||
406 | ret = videobuf_pci_dma_map(chip->pci,dma); | 406 | ret = videobuf_sg_dma_map(&chip->pci->dev, dma); |
407 | if (ret < 0) | 407 | if (ret < 0) |
408 | goto error; | 408 | goto error; |
409 | 409 | ||
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index c37269074524..d582395805df 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -1087,8 +1087,8 @@ static int mpeg_open(struct inode *inode, struct file *file) | |||
1087 | file->private_data = fh; | 1087 | file->private_data = fh; |
1088 | fh->dev = dev; | 1088 | fh->dev = dev; |
1089 | 1089 | ||
1090 | videobuf_queue_pci_init(&fh->mpegq, &blackbird_qops, | 1090 | videobuf_queue_sg_init(&fh->mpegq, &blackbird_qops, |
1091 | dev->pci, &dev->slock, | 1091 | &dev->pci->dev, &dev->slock, |
1092 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 1092 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
1093 | V4L2_FIELD_INTERLACED, | 1093 | V4L2_FIELD_INTERLACED, |
1094 | sizeof(struct cx88_buffer), | 1094 | sizeof(struct cx88_buffer), |
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 7586fe31f643..fa21666966e6 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -744,8 +744,8 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv) | |||
744 | 744 | ||
745 | /* dvb stuff */ | 745 | /* dvb stuff */ |
746 | printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name); | 746 | printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name); |
747 | videobuf_queue_pci_init(&dev->dvb.dvbq, &dvb_qops, | 747 | videobuf_queue_sg_init(&dev->dvb.dvbq, &dvb_qops, |
748 | dev->pci, &dev->slock, | 748 | &dev->pci->dev, &dev->slock, |
749 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 749 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
750 | V4L2_FIELD_TOP, | 750 | V4L2_FIELD_TOP, |
751 | sizeof(struct cx88_buffer), | 751 | sizeof(struct cx88_buffer), |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 8b293a3357b2..c30356bb35e9 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -776,14 +776,14 @@ static int video_open(struct inode *inode, struct file *file) | |||
776 | fh->height = 240; | 776 | fh->height = 240; |
777 | fh->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24); | 777 | fh->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24); |
778 | 778 | ||
779 | videobuf_queue_pci_init(&fh->vidq, &cx8800_video_qops, | 779 | videobuf_queue_sg_init(&fh->vidq, &cx8800_video_qops, |
780 | dev->pci, &dev->slock, | 780 | &dev->pci->dev, &dev->slock, |
781 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 781 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
782 | V4L2_FIELD_INTERLACED, | 782 | V4L2_FIELD_INTERLACED, |
783 | sizeof(struct cx88_buffer), | 783 | sizeof(struct cx88_buffer), |
784 | fh); | 784 | fh); |
785 | videobuf_queue_pci_init(&fh->vbiq, &cx8800_vbi_qops, | 785 | videobuf_queue_sg_init(&fh->vbiq, &cx8800_vbi_qops, |
786 | dev->pci, &dev->slock, | 786 | &dev->pci->dev, &dev->slock, |
787 | V4L2_BUF_TYPE_VBI_CAPTURE, | 787 | V4L2_BUF_TYPE_VBI_CAPTURE, |
788 | V4L2_FIELD_SEQ_TB, | 788 | V4L2_FIELD_SEQ_TB, |
789 | sizeof(struct cx88_buffer), | 789 | sizeof(struct cx88_buffer), |
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index 505bc0a478af..048081be91fe 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c | |||
@@ -503,7 +503,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, | |||
503 | /* release the old buffer */ | 503 | /* release the old buffer */ |
504 | if (substream->runtime->dma_area) { | 504 | if (substream->runtime->dma_area) { |
505 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); | 505 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); |
506 | videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); | 506 | videobuf_sg_dma_unmap(&dev->pci->dev, &dev->dmasound.dma); |
507 | dsp_buffer_free(dev); | 507 | dsp_buffer_free(dev); |
508 | substream->runtime->dma_area = NULL; | 508 | substream->runtime->dma_area = NULL; |
509 | } | 509 | } |
@@ -519,12 +519,12 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, | |||
519 | return err; | 519 | return err; |
520 | } | 520 | } |
521 | 521 | ||
522 | if (0 != (err = videobuf_pci_dma_map(dev->pci, &dev->dmasound.dma))) { | 522 | if (0 != (err = videobuf_sg_dma_map(&dev->pci->dev, &dev->dmasound.dma))) { |
523 | dsp_buffer_free(dev); | 523 | dsp_buffer_free(dev); |
524 | return err; | 524 | return err; |
525 | } | 525 | } |
526 | if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) { | 526 | if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) { |
527 | videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); | 527 | videobuf_sg_dma_unmap(&dev->pci->dev, &dev->dmasound.dma); |
528 | dsp_buffer_free(dev); | 528 | dsp_buffer_free(dev); |
529 | return err; | 529 | return err; |
530 | } | 530 | } |
@@ -533,7 +533,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, | |||
533 | dev->dmasound.dma.sglen, | 533 | dev->dmasound.dma.sglen, |
534 | 0))) { | 534 | 0))) { |
535 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); | 535 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); |
536 | videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); | 536 | videobuf_sg_dma_unmap(&dev->pci->dev, &dev->dmasound.dma); |
537 | dsp_buffer_free(dev); | 537 | dsp_buffer_free(dev); |
538 | return err; | 538 | return err; |
539 | } | 539 | } |
@@ -569,7 +569,7 @@ static int snd_card_saa7134_hw_free(struct snd_pcm_substream * substream) | |||
569 | 569 | ||
570 | if (substream->runtime->dma_area) { | 570 | if (substream->runtime->dma_area) { |
571 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); | 571 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); |
572 | videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); | 572 | videobuf_sg_dma_unmap(&dev->pci->dev, &dev->dmasound.dma); |
573 | dsp_buffer_free(dev); | 573 | dsp_buffer_free(dev); |
574 | substream->runtime->dma_area = NULL; | 574 | substream->runtime->dma_area = NULL; |
575 | } | 575 | } |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index b55df4877aff..eabc67d03b2c 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -899,8 +899,8 @@ static int dvb_init(struct saa7134_dev *dev) | |||
899 | dev->ts.nr_bufs = 32; | 899 | dev->ts.nr_bufs = 32; |
900 | dev->ts.nr_packets = 32*4; | 900 | dev->ts.nr_packets = 32*4; |
901 | dev->dvb.name = dev->name; | 901 | dev->dvb.name = dev->name; |
902 | videobuf_queue_pci_init(&dev->dvb.dvbq, &saa7134_ts_qops, | 902 | videobuf_queue_sg_init(&dev->dvb.dvbq, &saa7134_ts_qops, |
903 | dev->pci, &dev->slock, | 903 | &dev->pci->dev, &dev->slock, |
904 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 904 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
905 | V4L2_FIELD_ALTERNATE, | 905 | V4L2_FIELD_ALTERNATE, |
906 | sizeof(struct saa7134_buf), | 906 | sizeof(struct saa7134_buf), |
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index 40d4a66b77f5..e002be568c21 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -427,8 +427,8 @@ static int empress_init(struct saa7134_dev *dev) | |||
427 | printk(KERN_INFO "%s: registered device video%d [mpeg]\n", | 427 | printk(KERN_INFO "%s: registered device video%d [mpeg]\n", |
428 | dev->name,dev->empress_dev->minor & 0x1f); | 428 | dev->name,dev->empress_dev->minor & 0x1f); |
429 | 429 | ||
430 | videobuf_queue_pci_init(&dev->empress_tsq, &saa7134_ts_qops, | 430 | videobuf_queue_sg_init(&dev->empress_tsq, &saa7134_ts_qops, |
431 | dev->pci, &dev->slock, | 431 | &dev->pci->dev, &dev->slock, |
432 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 432 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
433 | V4L2_FIELD_ALTERNATE, | 433 | V4L2_FIELD_ALTERNATE, |
434 | sizeof(struct saa7134_buf), | 434 | sizeof(struct saa7134_buf), |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 5385026a85ef..ecc5243da57e 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -1350,14 +1350,14 @@ static int video_open(struct inode *inode, struct file *file) | |||
1350 | fh->height = 576; | 1350 | fh->height = 576; |
1351 | v4l2_prio_open(&dev->prio,&fh->prio); | 1351 | v4l2_prio_open(&dev->prio,&fh->prio); |
1352 | 1352 | ||
1353 | videobuf_queue_pci_init(&fh->cap, &video_qops, | 1353 | videobuf_queue_sg_init(&fh->cap, &video_qops, |
1354 | dev->pci, &dev->slock, | 1354 | &dev->pci->dev, &dev->slock, |
1355 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 1355 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
1356 | V4L2_FIELD_INTERLACED, | 1356 | V4L2_FIELD_INTERLACED, |
1357 | sizeof(struct saa7134_buf), | 1357 | sizeof(struct saa7134_buf), |
1358 | fh); | 1358 | fh); |
1359 | videobuf_queue_pci_init(&fh->vbi, &saa7134_vbi_qops, | 1359 | videobuf_queue_sg_init(&fh->vbi, &saa7134_vbi_qops, |
1360 | dev->pci, &dev->slock, | 1360 | &dev->pci->dev, &dev->slock, |
1361 | V4L2_BUF_TYPE_VBI_CAPTURE, | 1361 | V4L2_BUF_TYPE_VBI_CAPTURE, |
1362 | V4L2_FIELD_SEQ_TB, | 1362 | V4L2_FIELD_SEQ_TB, |
1363 | sizeof(struct saa7134_buf), | 1363 | sizeof(struct saa7134_buf), |
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 904e9dfc1a89..c947525c3f2f 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
@@ -210,7 +210,7 @@ static int soc_camera_open(struct inode *inode, struct file *file) | |||
210 | 210 | ||
211 | /* We must pass NULL as dev pointer, then all pci_* dma operations | 211 | /* We must pass NULL as dev pointer, then all pci_* dma operations |
212 | * transform to normal dma_* ones. Do we need an irqlock? */ | 212 | * transform to normal dma_* ones. Do we need an irqlock? */ |
213 | videobuf_queue_pci_init(&icf->vb_vidq, ici->vbq_ops, NULL, NULL, | 213 | videobuf_queue_sg_init(&icf->vb_vidq, ici->vbq_ops, NULL, NULL, |
214 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, | 214 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, |
215 | ici->msize, icd); | 215 | ici->msize, icd); |
216 | 216 | ||
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index 7008afabe92c..6141a13bfc97 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * helper functions for PCI DMA video4linux capture buffers | 2 | * helper functions for SG DMA video4linux capture buffers |
3 | * | 3 | * |
4 | * The functions expect the hardware being able to scatter gatter | 4 | * The functions expect the hardware being able to scatter gatter |
5 | * (i.e. the buffers are not linear in physical memory, but fragmented | 5 | * (i.e. the buffers are not linear in physical memory, but fragmented |
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | 26 | ||
27 | #include <linux/pci.h> | 27 | #include <linux/dma-mapping.h> |
28 | #include <linux/vmalloc.h> | 28 | #include <linux/vmalloc.h> |
29 | #include <linux/pagemap.h> | 29 | #include <linux/pagemap.h> |
30 | #include <linux/scatterlist.h> | 30 | #include <linux/scatterlist.h> |
@@ -42,7 +42,7 @@ | |||
42 | static int debug; | 42 | static int debug; |
43 | module_param(debug, int, 0644); | 43 | module_param(debug, int, 0644); |
44 | 44 | ||
45 | MODULE_DESCRIPTION("helper module to manage video4linux pci dma sg buffers"); | 45 | MODULE_DESCRIPTION("helper module to manage video4linux dma sg buffers"); |
46 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>"); | 46 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>"); |
47 | MODULE_LICENSE("GPL"); | 47 | MODULE_LICENSE("GPL"); |
48 | 48 | ||
@@ -119,10 +119,10 @@ videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset) | |||
119 | 119 | ||
120 | struct videobuf_dmabuf *videobuf_to_dma (struct videobuf_buffer *buf) | 120 | struct videobuf_dmabuf *videobuf_to_dma (struct videobuf_buffer *buf) |
121 | { | 121 | { |
122 | struct videbuf_pci_sg_memory *mem=buf->priv; | 122 | struct videobuf_dma_sg_memory *mem = buf->priv; |
123 | BUG_ON (!mem); | 123 | BUG_ON(!mem); |
124 | 124 | ||
125 | MAGIC_CHECK(mem->magic,MAGIC_SG_MEM); | 125 | MAGIC_CHECK(mem->magic, MAGIC_SG_MEM); |
126 | 126 | ||
127 | return &mem->dma; | 127 | return &mem->dma; |
128 | } | 128 | } |
@@ -141,9 +141,14 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma, | |||
141 | 141 | ||
142 | dma->direction = direction; | 142 | dma->direction = direction; |
143 | switch (dma->direction) { | 143 | switch (dma->direction) { |
144 | case PCI_DMA_FROMDEVICE: rw = READ; break; | 144 | case DMA_FROM_DEVICE: |
145 | case PCI_DMA_TODEVICE: rw = WRITE; break; | 145 | rw = READ; |
146 | default: BUG(); | 146 | break; |
147 | case DMA_TO_DEVICE: | ||
148 | rw = WRITE; | ||
149 | break; | ||
150 | default: | ||
151 | BUG(); | ||
147 | } | 152 | } |
148 | 153 | ||
149 | first = (data & PAGE_MASK) >> PAGE_SHIFT; | 154 | first = (data & PAGE_MASK) >> PAGE_SHIFT; |
@@ -216,10 +221,8 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, | |||
216 | return 0; | 221 | return 0; |
217 | } | 222 | } |
218 | 223 | ||
219 | int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma) | 224 | int videobuf_dma_map(struct videobuf_queue* q, struct videobuf_dmabuf *dma) |
220 | { | 225 | { |
221 | void *dev=q->dev; | ||
222 | |||
223 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); | 226 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); |
224 | BUG_ON(0 == dma->nr_pages); | 227 | BUG_ON(0 == dma->nr_pages); |
225 | 228 | ||
@@ -245,7 +248,7 @@ int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma) | |||
245 | return -ENOMEM; | 248 | return -ENOMEM; |
246 | } | 249 | } |
247 | if (!dma->bus_addr) { | 250 | if (!dma->bus_addr) { |
248 | dma->sglen = pci_map_sg(dev,dma->sglist, | 251 | dma->sglen = dma_map_sg(q->dev, dma->sglist, |
249 | dma->nr_pages, dma->direction); | 252 | dma->nr_pages, dma->direction); |
250 | if (0 == dma->sglen) { | 253 | if (0 == dma->sglen) { |
251 | printk(KERN_WARNING | 254 | printk(KERN_WARNING |
@@ -259,14 +262,12 @@ int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma) | |||
259 | return 0; | 262 | return 0; |
260 | } | 263 | } |
261 | 264 | ||
262 | int videobuf_dma_sync(struct videobuf_queue *q,struct videobuf_dmabuf *dma) | 265 | int videobuf_dma_sync(struct videobuf_queue *q, struct videobuf_dmabuf *dma) |
263 | { | 266 | { |
264 | void *dev=q->dev; | 267 | MAGIC_CHECK(dma->magic, MAGIC_DMABUF); |
265 | |||
266 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); | ||
267 | BUG_ON(!dma->sglen); | 268 | BUG_ON(!dma->sglen); |
268 | 269 | ||
269 | pci_dma_sync_sg_for_cpu (dev,dma->sglist,dma->nr_pages,dma->direction); | 270 | dma_sync_sg_for_cpu(q->dev, dma->sglist, dma->nr_pages, dma->direction); |
270 | return 0; | 271 | return 0; |
271 | } | 272 | } |
272 | 273 | ||
@@ -274,11 +275,11 @@ int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma) | |||
274 | { | 275 | { |
275 | void *dev=q->dev; | 276 | void *dev=q->dev; |
276 | 277 | ||
277 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); | 278 | MAGIC_CHECK(dma->magic, MAGIC_DMABUF); |
278 | if (!dma->sglen) | 279 | if (!dma->sglen) |
279 | return 0; | 280 | return 0; |
280 | 281 | ||
281 | pci_unmap_sg (dev,dma->sglist,dma->nr_pages,dma->direction); | 282 | dma_unmap_sg(q->dev, dma->sglist, dma->nr_pages, dma->direction); |
282 | 283 | ||
283 | kfree(dma->sglist); | 284 | kfree(dma->sglist); |
284 | dma->sglist = NULL; | 285 | dma->sglist = NULL; |
@@ -306,28 +307,28 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma) | |||
306 | if (dma->bus_addr) { | 307 | if (dma->bus_addr) { |
307 | dma->bus_addr = 0; | 308 | dma->bus_addr = 0; |
308 | } | 309 | } |
309 | dma->direction = PCI_DMA_NONE; | 310 | dma->direction = DMA_NONE; |
310 | return 0; | 311 | return 0; |
311 | } | 312 | } |
312 | 313 | ||
313 | /* --------------------------------------------------------------------- */ | 314 | /* --------------------------------------------------------------------- */ |
314 | 315 | ||
315 | int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma) | 316 | int videobuf_sg_dma_map(struct device *dev, struct videobuf_dmabuf *dma) |
316 | { | 317 | { |
317 | struct videobuf_queue q; | 318 | struct videobuf_queue q; |
318 | 319 | ||
319 | q.dev=pci; | 320 | q.dev = dev; |
320 | 321 | ||
321 | return (videobuf_dma_map(&q,dma)); | 322 | return videobuf_dma_map(&q, dma); |
322 | } | 323 | } |
323 | 324 | ||
324 | int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma) | 325 | int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma) |
325 | { | 326 | { |
326 | struct videobuf_queue q; | 327 | struct videobuf_queue q; |
327 | 328 | ||
328 | q.dev=pci; | 329 | q.dev = dev; |
329 | 330 | ||
330 | return (videobuf_dma_unmap(&q,dma)); | 331 | return videobuf_dma_unmap(&q, dma); |
331 | } | 332 | } |
332 | 333 | ||
333 | /* --------------------------------------------------------------------- */ | 334 | /* --------------------------------------------------------------------- */ |
@@ -347,7 +348,7 @@ videobuf_vm_close(struct vm_area_struct *vma) | |||
347 | { | 348 | { |
348 | struct videobuf_mapping *map = vma->vm_private_data; | 349 | struct videobuf_mapping *map = vma->vm_private_data; |
349 | struct videobuf_queue *q = map->q; | 350 | struct videobuf_queue *q = map->q; |
350 | struct videbuf_pci_sg_memory *mem; | 351 | struct videobuf_dma_sg_memory *mem; |
351 | int i; | 352 | int i; |
352 | 353 | ||
353 | dprintk(2,"vm_close %p [count=%d,vma=%08lx-%08lx]\n",map, | 354 | dprintk(2,"vm_close %p [count=%d,vma=%08lx-%08lx]\n",map, |
@@ -409,18 +410,18 @@ static struct vm_operations_struct videobuf_vm_ops = | |||
409 | }; | 410 | }; |
410 | 411 | ||
411 | /* --------------------------------------------------------------------- | 412 | /* --------------------------------------------------------------------- |
412 | * PCI handlers for the generic methods | 413 | * SG handlers for the generic methods |
413 | */ | 414 | */ |
414 | 415 | ||
415 | /* Allocated area consists on 3 parts: | 416 | /* Allocated area consists on 3 parts: |
416 | struct video_buffer | 417 | struct video_buffer |
417 | struct <driver>_buffer (cx88_buffer, saa7134_buf, ...) | 418 | struct <driver>_buffer (cx88_buffer, saa7134_buf, ...) |
418 | struct videobuf_pci_sg_memory | 419 | struct videobuf_dma_sg_memory |
419 | */ | 420 | */ |
420 | 421 | ||
421 | static void *__videobuf_alloc(size_t size) | 422 | static void *__videobuf_alloc(size_t size) |
422 | { | 423 | { |
423 | struct videbuf_pci_sg_memory *mem; | 424 | struct videobuf_dma_sg_memory *mem; |
424 | struct videobuf_buffer *vb; | 425 | struct videobuf_buffer *vb; |
425 | 426 | ||
426 | vb = kzalloc(size+sizeof(*mem),GFP_KERNEL); | 427 | vb = kzalloc(size+sizeof(*mem),GFP_KERNEL); |
@@ -443,10 +444,10 @@ static int __videobuf_iolock (struct videobuf_queue* q, | |||
443 | { | 444 | { |
444 | int err,pages; | 445 | int err,pages; |
445 | dma_addr_t bus; | 446 | dma_addr_t bus; |
446 | struct videbuf_pci_sg_memory *mem=vb->priv; | 447 | struct videobuf_dma_sg_memory *mem = vb->priv; |
447 | BUG_ON(!mem); | 448 | BUG_ON(!mem); |
448 | 449 | ||
449 | MAGIC_CHECK(mem->magic,MAGIC_SG_MEM); | 450 | MAGIC_CHECK(mem->magic, MAGIC_SG_MEM); |
450 | 451 | ||
451 | switch (vb->memory) { | 452 | switch (vb->memory) { |
452 | case V4L2_MEMORY_MMAP: | 453 | case V4L2_MEMORY_MMAP: |
@@ -455,14 +456,14 @@ static int __videobuf_iolock (struct videobuf_queue* q, | |||
455 | /* no userspace addr -- kernel bounce buffer */ | 456 | /* no userspace addr -- kernel bounce buffer */ |
456 | pages = PAGE_ALIGN(vb->size) >> PAGE_SHIFT; | 457 | pages = PAGE_ALIGN(vb->size) >> PAGE_SHIFT; |
457 | err = videobuf_dma_init_kernel( &mem->dma, | 458 | err = videobuf_dma_init_kernel( &mem->dma, |
458 | PCI_DMA_FROMDEVICE, | 459 | DMA_FROM_DEVICE, |
459 | pages ); | 460 | pages ); |
460 | if (0 != err) | 461 | if (0 != err) |
461 | return err; | 462 | return err; |
462 | } else if (vb->memory == V4L2_MEMORY_USERPTR) { | 463 | } else if (vb->memory == V4L2_MEMORY_USERPTR) { |
463 | /* dma directly to userspace */ | 464 | /* dma directly to userspace */ |
464 | err = videobuf_dma_init_user( &mem->dma, | 465 | err = videobuf_dma_init_user( &mem->dma, |
465 | PCI_DMA_FROMDEVICE, | 466 | DMA_FROM_DEVICE, |
466 | vb->baddr,vb->bsize ); | 467 | vb->baddr,vb->bsize ); |
467 | if (0 != err) | 468 | if (0 != err) |
468 | return err; | 469 | return err; |
@@ -473,7 +474,7 @@ static int __videobuf_iolock (struct videobuf_queue* q, | |||
473 | locking inversion, so don't take it here */ | 474 | locking inversion, so don't take it here */ |
474 | 475 | ||
475 | err = videobuf_dma_init_user_locked(&mem->dma, | 476 | err = videobuf_dma_init_user_locked(&mem->dma, |
476 | PCI_DMA_FROMDEVICE, | 477 | DMA_FROM_DEVICE, |
477 | vb->baddr, vb->bsize); | 478 | vb->baddr, vb->bsize); |
478 | if (0 != err) | 479 | if (0 != err) |
479 | return err; | 480 | return err; |
@@ -490,7 +491,7 @@ static int __videobuf_iolock (struct videobuf_queue* q, | |||
490 | */ | 491 | */ |
491 | bus = (dma_addr_t)(unsigned long)fbuf->base + vb->boff; | 492 | bus = (dma_addr_t)(unsigned long)fbuf->base + vb->boff; |
492 | pages = PAGE_ALIGN(vb->size) >> PAGE_SHIFT; | 493 | pages = PAGE_ALIGN(vb->size) >> PAGE_SHIFT; |
493 | err = videobuf_dma_init_overlay(&mem->dma,PCI_DMA_FROMDEVICE, | 494 | err = videobuf_dma_init_overlay(&mem->dma, DMA_FROM_DEVICE, |
494 | bus, pages); | 495 | bus, pages); |
495 | if (0 != err) | 496 | if (0 != err) |
496 | return err; | 497 | return err; |
@@ -498,7 +499,7 @@ static int __videobuf_iolock (struct videobuf_queue* q, | |||
498 | default: | 499 | default: |
499 | BUG(); | 500 | BUG(); |
500 | } | 501 | } |
501 | err = videobuf_dma_map(q,&mem->dma); | 502 | err = videobuf_dma_map(q, &mem->dma); |
502 | if (0 != err) | 503 | if (0 != err) |
503 | return err; | 504 | return err; |
504 | 505 | ||
@@ -508,8 +509,8 @@ static int __videobuf_iolock (struct videobuf_queue* q, | |||
508 | static int __videobuf_sync(struct videobuf_queue *q, | 509 | static int __videobuf_sync(struct videobuf_queue *q, |
509 | struct videobuf_buffer *buf) | 510 | struct videobuf_buffer *buf) |
510 | { | 511 | { |
511 | struct videbuf_pci_sg_memory *mem=buf->priv; | 512 | struct videobuf_dma_sg_memory *mem = buf->priv; |
512 | BUG_ON (!mem); | 513 | BUG_ON(!mem); |
513 | MAGIC_CHECK(mem->magic,MAGIC_SG_MEM); | 514 | MAGIC_CHECK(mem->magic,MAGIC_SG_MEM); |
514 | 515 | ||
515 | return videobuf_dma_sync(q,&mem->dma); | 516 | return videobuf_dma_sync(q,&mem->dma); |
@@ -532,7 +533,7 @@ static int __videobuf_mmap_free(struct videobuf_queue *q) | |||
532 | static int __videobuf_mmap_mapper(struct videobuf_queue *q, | 533 | static int __videobuf_mmap_mapper(struct videobuf_queue *q, |
533 | struct vm_area_struct *vma) | 534 | struct vm_area_struct *vma) |
534 | { | 535 | { |
535 | struct videbuf_pci_sg_memory *mem; | 536 | struct videobuf_dma_sg_memory *mem; |
536 | struct videobuf_mapping *map; | 537 | struct videobuf_mapping *map; |
537 | unsigned int first,last,size,i; | 538 | unsigned int first,last,size,i; |
538 | int retval; | 539 | int retval; |
@@ -552,7 +553,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, | |||
552 | if (NULL == q->bufs[first]) | 553 | if (NULL == q->bufs[first]) |
553 | continue; | 554 | continue; |
554 | mem=q->bufs[first]->priv; | 555 | mem=q->bufs[first]->priv; |
555 | BUG_ON (!mem); | 556 | BUG_ON(!mem); |
556 | MAGIC_CHECK(mem->magic,MAGIC_SG_MEM); | 557 | MAGIC_CHECK(mem->magic,MAGIC_SG_MEM); |
557 | 558 | ||
558 | if (V4L2_MEMORY_MMAP != q->bufs[first]->memory) | 559 | if (V4L2_MEMORY_MMAP != q->bufs[first]->memory) |
@@ -615,8 +616,8 @@ static int __videobuf_copy_to_user ( struct videobuf_queue *q, | |||
615 | char __user *data, size_t count, | 616 | char __user *data, size_t count, |
616 | int nonblocking ) | 617 | int nonblocking ) |
617 | { | 618 | { |
618 | struct videbuf_pci_sg_memory *mem=q->read_buf->priv; | 619 | struct videobuf_dma_sg_memory *mem = q->read_buf->priv; |
619 | BUG_ON (!mem); | 620 | BUG_ON(!mem); |
620 | MAGIC_CHECK(mem->magic,MAGIC_SG_MEM); | 621 | MAGIC_CHECK(mem->magic,MAGIC_SG_MEM); |
621 | 622 | ||
622 | /* copy to userspace */ | 623 | /* copy to userspace */ |
@@ -634,8 +635,8 @@ static int __videobuf_copy_stream ( struct videobuf_queue *q, | |||
634 | int vbihack, int nonblocking ) | 635 | int vbihack, int nonblocking ) |
635 | { | 636 | { |
636 | unsigned int *fc; | 637 | unsigned int *fc; |
637 | struct videbuf_pci_sg_memory *mem=q->read_buf->priv; | 638 | struct videobuf_dma_sg_memory *mem = q->read_buf->priv; |
638 | BUG_ON (!mem); | 639 | BUG_ON(!mem); |
639 | MAGIC_CHECK(mem->magic,MAGIC_SG_MEM); | 640 | MAGIC_CHECK(mem->magic,MAGIC_SG_MEM); |
640 | 641 | ||
641 | if (vbihack) { | 642 | if (vbihack) { |
@@ -658,7 +659,7 @@ static int __videobuf_copy_stream ( struct videobuf_queue *q, | |||
658 | return count; | 659 | return count; |
659 | } | 660 | } |
660 | 661 | ||
661 | static struct videobuf_qtype_ops pci_ops = { | 662 | static struct videobuf_qtype_ops sg_ops = { |
662 | .magic = MAGIC_QTYPE_OPS, | 663 | .magic = MAGIC_QTYPE_OPS, |
663 | 664 | ||
664 | .alloc = __videobuf_alloc, | 665 | .alloc = __videobuf_alloc, |
@@ -670,21 +671,21 @@ static struct videobuf_qtype_ops pci_ops = { | |||
670 | .copy_stream = __videobuf_copy_stream, | 671 | .copy_stream = __videobuf_copy_stream, |
671 | }; | 672 | }; |
672 | 673 | ||
673 | void *videobuf_pci_alloc (size_t size) | 674 | void *videobuf_sg_alloc(size_t size) |
674 | { | 675 | { |
675 | struct videobuf_queue q; | 676 | struct videobuf_queue q; |
676 | 677 | ||
677 | /* Required to make generic handler to call __videobuf_alloc */ | 678 | /* Required to make generic handler to call __videobuf_alloc */ |
678 | q.int_ops=&pci_ops; | 679 | q.int_ops = &sg_ops; |
679 | 680 | ||
680 | q.msize=size; | 681 | q.msize = size; |
681 | 682 | ||
682 | return videobuf_alloc (&q); | 683 | return videobuf_alloc(&q); |
683 | } | 684 | } |
684 | 685 | ||
685 | void videobuf_queue_pci_init(struct videobuf_queue* q, | 686 | void videobuf_queue_sg_init(struct videobuf_queue* q, |
686 | struct videobuf_queue_ops *ops, | 687 | struct videobuf_queue_ops *ops, |
687 | void *dev, | 688 | struct device *dev, |
688 | spinlock_t *irqlock, | 689 | spinlock_t *irqlock, |
689 | enum v4l2_buf_type type, | 690 | enum v4l2_buf_type type, |
690 | enum v4l2_field field, | 691 | enum v4l2_field field, |
@@ -692,7 +693,7 @@ void videobuf_queue_pci_init(struct videobuf_queue* q, | |||
692 | void *priv) | 693 | void *priv) |
693 | { | 694 | { |
694 | videobuf_queue_core_init(q, ops, dev, irqlock, type, field, msize, | 695 | videobuf_queue_core_init(q, ops, dev, irqlock, type, field, msize, |
695 | priv, &pci_ops); | 696 | priv, &sg_ops); |
696 | } | 697 | } |
697 | 698 | ||
698 | /* --------------------------------------------------------------------- */ | 699 | /* --------------------------------------------------------------------- */ |
@@ -709,11 +710,11 @@ EXPORT_SYMBOL_GPL(videobuf_dma_sync); | |||
709 | EXPORT_SYMBOL_GPL(videobuf_dma_unmap); | 710 | EXPORT_SYMBOL_GPL(videobuf_dma_unmap); |
710 | EXPORT_SYMBOL_GPL(videobuf_dma_free); | 711 | EXPORT_SYMBOL_GPL(videobuf_dma_free); |
711 | 712 | ||
712 | EXPORT_SYMBOL_GPL(videobuf_pci_dma_map); | 713 | EXPORT_SYMBOL_GPL(videobuf_sg_dma_map); |
713 | EXPORT_SYMBOL_GPL(videobuf_pci_dma_unmap); | 714 | EXPORT_SYMBOL_GPL(videobuf_sg_dma_unmap); |
714 | EXPORT_SYMBOL_GPL(videobuf_pci_alloc); | 715 | EXPORT_SYMBOL_GPL(videobuf_sg_alloc); |
715 | 716 | ||
716 | EXPORT_SYMBOL_GPL(videobuf_queue_pci_init); | 717 | EXPORT_SYMBOL_GPL(videobuf_queue_sg_init); |
717 | 718 | ||
718 | /* | 719 | /* |
719 | * Local variables: | 720 | * Local variables: |
diff --git a/drivers/media/video/videobuf-vmalloc.c b/drivers/media/video/videobuf-vmalloc.c index 3de3c8920175..4a2508dfa0e3 100644 --- a/drivers/media/video/videobuf-vmalloc.c +++ b/drivers/media/video/videobuf-vmalloc.c | |||
@@ -102,7 +102,7 @@ static struct vm_operations_struct videobuf_vm_ops = | |||
102 | /* Allocated area consists on 3 parts: | 102 | /* Allocated area consists on 3 parts: |
103 | struct video_buffer | 103 | struct video_buffer |
104 | struct <driver>_buffer (cx88_buffer, saa7134_buf, ...) | 104 | struct <driver>_buffer (cx88_buffer, saa7134_buf, ...) |
105 | struct videobuf_pci_sg_memory | 105 | struct videobuf_dma_sg_memory |
106 | */ | 106 | */ |
107 | 107 | ||
108 | static void *__videobuf_alloc(size_t size) | 108 | static void *__videobuf_alloc(size_t size) |