]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
V4L/DVB: videobuf: Remove the videobuf_sg_dma_map/unmap functions
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tue, 11 May 2010 13:36:30 +0000 (10:36 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 2 Aug 2010 18:21:45 +0000 (15:21 -0300)
Instead of creating dirty wrappers around videobuf_dma_map/unmap that
create a dummy videobuf_queue structure, modify videobuf_dma_map/unmap
to take a device pointer argument and use it directly. The
videobuf_sg_dma_map/unmap then become unused and can be removed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
13 files changed:
drivers/media/common/saa7146_fops.c
drivers/media/video/bt8xx/bttv-risc.c
drivers/media/video/cx23885/cx23885-core.c
drivers/media/video/cx88/cx88-alsa.c
drivers/media/video/cx88/cx88-core.c
drivers/media/video/omap24xxcam.c
drivers/media/video/pxa_camera.c
drivers/media/video/saa7134/saa7134-alsa.c
drivers/media/video/saa7134/saa7134-core.c
drivers/media/video/videobuf-dma-sg.c
drivers/staging/cx25821/cx25821-alsa.c
drivers/staging/cx25821/cx25821-core.c
include/media/videobuf-dma-sg.h

index 7364b9642d005c0579838c4efdf7c61888767f98..4da2a54cb8bde6b1a9052df74300418432f9a7f3 100644 (file)
@@ -57,7 +57,7 @@ void saa7146_dma_free(struct saa7146_dev *dev,struct videobuf_queue *q,
        BUG_ON(in_interrupt());
 
        videobuf_waiton(&buf->vb,0,0);
-       videobuf_dma_unmap(q, dma);
+       videobuf_dma_unmap(q->dev, dma);
        videobuf_dma_free(dma);
        buf->vb.state = VIDEOBUF_NEEDS_INIT;
 }
index c24b1c100e13fe0fb1c225950c6427da7b50db7f..0fa9f39f37a32be9303993b3e4f31835c6042ebf 100644 (file)
@@ -583,7 +583,7 @@ bttv_dma_free(struct videobuf_queue *q,struct bttv *btv, struct bttv_buffer *buf
 
        BUG_ON(in_interrupt());
        videobuf_waiton(&buf->vb,0,0);
-       videobuf_dma_unmap(q, dma);
+       videobuf_dma_unmap(q->dev, dma);
        videobuf_dma_free(dma);
        btcx_riscmem_free(btv->c.pci,&buf->bottom);
        btcx_riscmem_free(btv->c.pci,&buf->top);
index 0dde57e96d30ac99c5adb9f8eab94f838c1b83d8..161ae7316c955abc7d6fa1a335056a2ee966ef6a 100644 (file)
@@ -1142,7 +1142,7 @@ void cx23885_free_buffer(struct videobuf_queue *q, struct cx23885_buffer *buf)
 
        BUG_ON(in_interrupt());
        videobuf_waiton(&buf->vb, 0, 0);
-       videobuf_dma_unmap(q, dma);
+       videobuf_dma_unmap(q->dev, dma);
        videobuf_dma_free(dma);
        btcx_riscmem_free(to_pci_dev(q->dev), &buf->risc);
        buf->vb.state = VIDEOBUF_NEEDS_INIT;
index 33082c96745ed91d9eb23aceba34562cc66e4c4a..07fe905f6575fd0a06a86248075117201d074251 100644 (file)
@@ -283,7 +283,7 @@ static int dsp_buffer_free(snd_cx88_card_t *chip)
        BUG_ON(!chip->dma_size);
 
        dprintk(2,"Freeing buffer\n");
-       videobuf_sg_dma_unmap(&chip->pci->dev, chip->dma_risc);
+       videobuf_dma_unmap(&chip->pci->dev, chip->dma_risc);
        videobuf_dma_free(chip->dma_risc);
        btcx_riscmem_free(chip->pci,&chip->buf->risc);
        kfree(chip->buf);
@@ -409,7 +409,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
        if (ret < 0)
                goto error;
 
-       ret = videobuf_sg_dma_map(&chip->pci->dev, dma);
+       ret = videobuf_dma_map(&chip->pci->dev, dma);
        if (ret < 0)
                goto error;
 
index 8b21457111b18dda2c656872fed49108db37dd4a..85eb266fb351fc9f9161ea7d5dcf62b5aed32843 100644 (file)
@@ -218,7 +218,7 @@ cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf)
 
        BUG_ON(in_interrupt());
        videobuf_waiton(&buf->vb,0,0);
-       videobuf_dma_unmap(q, dma);
+       videobuf_dma_unmap(q->dev, dma);
        videobuf_dma_free(dma);
        btcx_riscmem_free(to_pci_dev(q->dev), &buf->risc);
        buf->vb.state = VIDEOBUF_NEEDS_INIT;
index f85b2ed8a2d888d661c4df567fc2a4c4638bd5ee..926a5aa6f7f81951ac639c534a05ea0e4c5ac914 100644 (file)
@@ -426,7 +426,7 @@ static void omap24xxcam_vbq_release(struct videobuf_queue *vbq,
                             dma->direction);
                dma->direction = DMA_NONE;
        } else {
-               videobuf_dma_unmap(vbq, videobuf_to_dma(vb));
+               videobuf_dma_unmap(vbq->dev, videobuf_to_dma(vb));
                videobuf_dma_free(videobuf_to_dma(vb));
        }
 
index fb242f6cfb1f23b313df0ae80510ef8ec6042539..5835acf7fa7a1e6072115436f509845cfa394d5e 100644 (file)
@@ -276,7 +276,7 @@ static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf)
         * longer in STATE_QUEUED or STATE_ACTIVE
         */
        videobuf_waiton(&buf->vb, 0, 0);
-       videobuf_dma_unmap(vq, dma);
+       videobuf_dma_unmap(vq->dev, dma);
        videobuf_dma_free(dma);
 
        for (i = 0; i < ARRAY_SIZE(buf->dmas); i++) {
index d3bd82ad010a18010458cb0357de05501a11ec3e..5bca2abb31e62d5a327de4fa7bea833de806ca41 100644 (file)
@@ -630,7 +630,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
        /* release the old buffer */
        if (substream->runtime->dma_area) {
                saa7134_pgtable_free(dev->pci, &dev->dmasound.pt);
-               videobuf_sg_dma_unmap(&dev->pci->dev, &dev->dmasound.dma);
+               videobuf_dma_unmap(&dev->pci->dev, &dev->dmasound.dma);
                dsp_buffer_free(dev);
                substream->runtime->dma_area = NULL;
        }
@@ -646,12 +646,12 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
                return err;
        }
 
-       if (0 != (err = videobuf_sg_dma_map(&dev->pci->dev, &dev->dmasound.dma))) {
+       if (0 != (err = videobuf_dma_map(&dev->pci->dev, &dev->dmasound.dma))) {
                dsp_buffer_free(dev);
                return err;
        }
        if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) {
-               videobuf_sg_dma_unmap(&dev->pci->dev, &dev->dmasound.dma);
+               videobuf_dma_unmap(&dev->pci->dev, &dev->dmasound.dma);
                dsp_buffer_free(dev);
                return err;
        }
@@ -660,7 +660,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
                                                dev->dmasound.dma.sglen,
                                                0))) {
                saa7134_pgtable_free(dev->pci, &dev->dmasound.pt);
-               videobuf_sg_dma_unmap(&dev->pci->dev, &dev->dmasound.dma);
+               videobuf_dma_unmap(&dev->pci->dev, &dev->dmasound.dma);
                dsp_buffer_free(dev);
                return err;
        }
@@ -696,7 +696,7 @@ static int snd_card_saa7134_hw_free(struct snd_pcm_substream * substream)
 
        if (substream->runtime->dma_area) {
                saa7134_pgtable_free(dev->pci, &dev->dmasound.pt);
-               videobuf_sg_dma_unmap(&dev->pci->dev, &dev->dmasound.dma);
+               videobuf_dma_unmap(&dev->pci->dev, &dev->dmasound.dma);
                dsp_buffer_free(dev);
                substream->runtime->dma_area = NULL;
        }
index 90f23188129718b90f201410181cb278cd6ef5fb..40bc635e8a3f45f82608c3fbfd9be92042e76819 100644 (file)
@@ -256,7 +256,7 @@ void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf)
        BUG_ON(in_interrupt());
 
        videobuf_waiton(&buf->vb,0,0);
-       videobuf_dma_unmap(q, dma);
+       videobuf_dma_unmap(q->dev, dma);
        videobuf_dma_free(dma);
        buf->vb.state = VIDEOBUF_NEEDS_INIT;
 }
index a9b1091785789e6bdcc86b72da6a1b2b03875921..17b1f89e81337779359929d41b4fc53791e078b9 100644 (file)
@@ -235,7 +235,7 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction,
 }
 EXPORT_SYMBOL_GPL(videobuf_dma_init_overlay);
 
-int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma)
+int videobuf_dma_map(struct device *dev, struct videobuf_dmabuf *dma)
 {
        MAGIC_CHECK(dma->magic, MAGIC_DMABUF);
        BUG_ON(0 == dma->nr_pages);
@@ -263,7 +263,7 @@ int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma)
                return -ENOMEM;
        }
        if (!dma->bus_addr) {
-               dma->sglen = dma_map_sg(q->dev, dma->sglist,
+               dma->sglen = dma_map_sg(dev, dma->sglist,
                                        dma->nr_pages, dma->direction);
                if (0 == dma->sglen) {
                        printk(KERN_WARNING
@@ -279,14 +279,14 @@ int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma)
 }
 EXPORT_SYMBOL_GPL(videobuf_dma_map);
 
-int videobuf_dma_unmap(struct videobuf_queue *q, struct videobuf_dmabuf *dma)
+int videobuf_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma)
 {
        MAGIC_CHECK(dma->magic, MAGIC_DMABUF);
 
        if (!dma->sglen)
                return 0;
 
-       dma_unmap_sg(q->dev, dma->sglist, dma->sglen, dma->direction);
+       dma_unmap_sg(dev, dma->sglist, dma->sglen, dma->direction);
 
        vfree(dma->sglist);
        dma->sglist = NULL;
@@ -322,28 +322,6 @@ EXPORT_SYMBOL_GPL(videobuf_dma_free);
 
 /* --------------------------------------------------------------------- */
 
-int videobuf_sg_dma_map(struct device *dev, struct videobuf_dmabuf *dma)
-{
-       struct videobuf_queue q;
-
-       q.dev = dev;
-
-       return videobuf_dma_map(&q, dma);
-}
-EXPORT_SYMBOL_GPL(videobuf_sg_dma_map);
-
-int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma)
-{
-       struct videobuf_queue q;
-
-       q.dev = dev;
-
-       return videobuf_dma_unmap(&q, dma);
-}
-EXPORT_SYMBOL_GPL(videobuf_sg_dma_unmap);
-
-/* --------------------------------------------------------------------- */
-
 static void videobuf_vm_open(struct vm_area_struct *vma)
 {
        struct videobuf_mapping *map = vma->vm_private_data;
@@ -520,7 +498,7 @@ static int __videobuf_iolock(struct videobuf_queue *q,
        default:
                BUG();
        }
-       err = videobuf_dma_map(q, &mem->dma);
+       err = videobuf_dma_map(q->dev, &mem->dma);
        if (0 != err)
                return err;
 
index 1798975a69bdf814a33356781f6c759e8c4336e7..4ce8790b05ecc47a395729df999b6b03136a8134 100644 (file)
@@ -331,7 +331,7 @@ static int dsp_buffer_free(struct cx25821_audio_dev *chip)
        BUG_ON(!chip->dma_size);
 
        dprintk(2, "Freeing buffer\n");
-       videobuf_sg_dma_unmap(&chip->pci->dev, chip->dma_risc);
+       videobuf_dma_unmap(&chip->pci->dev, chip->dma_risc);
        videobuf_dma_free(chip->dma_risc);
        btcx_riscmem_free(chip->pci, &chip->buf->risc);
        kfree(chip->buf);
@@ -470,7 +470,7 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream,
        if (ret < 0)
                goto error;
 
-       ret = videobuf_sg_dma_map(&chip->pci->dev, dma);
+       ret = videobuf_dma_map(&chip->pci->dev, dma);
        if (ret < 0)
                goto error;
 
index be44195783d4bf815043d11f8d0cfddece76a66d..c487c19256b94af7710db77d41ff9f5d850fa9f2 100644 (file)
@@ -1320,7 +1320,7 @@ void cx25821_free_buffer(struct videobuf_queue *q, struct cx25821_buffer *buf)
 
        BUG_ON(in_interrupt());
        videobuf_waiton(&buf->vb, 0, 0);
-       videobuf_dma_unmap(q, dma);
+       videobuf_dma_unmap(q->dev, dma);
        videobuf_dma_free(dma);
        btcx_riscmem_free(to_pci_dev(q->dev), &buf->risc);
        buf->vb.state = VIDEOBUF_NEEDS_INIT;
index a195f3b9c00a7dba5bca7887ae2e64decb1c1411..80130100e450463c86fa4e1e1f7aba7eb2c5ea23 100644 (file)
@@ -87,6 +87,16 @@ struct videobuf_dma_sg_memory {
        struct videobuf_dmabuf  dma;
 };
 
+/*
+ * Scatter-gather DMA buffer API.
+ *
+ * These functions provide a simple way to create a page list and a
+ * scatter-gather list from a kernel, userspace of physical address and map the
+ * memory for DMA operation.
+ *
+ * Despite the name, this is totally unrelated to videobuf, except that
+ * videobuf-dma-sg uses the same API internally.
+ */
 void videobuf_dma_init(struct videobuf_dmabuf *dma);
 int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction,
                           unsigned long data, unsigned long size);
@@ -96,8 +106,8 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction,
                              dma_addr_t addr, int nr_pages);
 int videobuf_dma_free(struct videobuf_dmabuf *dma);
 
-int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma);
-int videobuf_dma_unmap(struct videobuf_queue *q, struct videobuf_dmabuf *dma);
+int videobuf_dma_map(struct device *dev, struct videobuf_dmabuf *dma);
+int videobuf_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma);
 struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf);
 
 void *videobuf_sg_alloc(size_t size);
@@ -111,11 +121,5 @@ void videobuf_queue_sg_init(struct videobuf_queue *q,
                         unsigned int msize,
                         void *priv);
 
-/*FIXME: these variants are used only on *-alsa code, where videobuf is
- * used without queue
- */
-int videobuf_sg_dma_map(struct device *dev, struct videobuf_dmabuf *dma);
-int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma);
-
 #endif /* _VIDEOBUF_DMA_SG_H */