]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (7566): videobuf-dvb: allow its usage with videobuf-vmalloc
authorMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 13 Apr 2008 18:10:00 +0000 (15:10 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Thu, 24 Apr 2008 17:09:39 +0000 (14:09 -0300)
videobuf-dvb were still using a function that were videobuf-dma-sg
dependent. This patch creates a generic handler for this function. This
way, videobuf-dvb can now work with all videobuf implementations.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/videobuf-core.c
drivers/media/video/videobuf-dma-sg.c
drivers/media/video/videobuf-dvb.c
drivers/media/video/videobuf-vmalloc.c
include/media/videobuf-core.h
include/media/videobuf-vmalloc.h

index 848a2d0e1233908c051d87a9338e29c3835563fd..fc51e4918bbf790d05ee8d93160a31ddd994aefb 100644 (file)
@@ -94,6 +94,13 @@ int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb,
        return CALL(q, iolock, q, vb, fbuf);
 }
 
+void *videobuf_queue_to_vmalloc (struct videobuf_queue *q,
+                          struct videobuf_buffer *buf)
+{
+       return CALL(q, vmalloc, buf);
+}
+EXPORT_SYMBOL_GPL(videobuf_queue_to_vmalloc);
+
 /* --------------------------------------------------------------------- */
 
 
index c0b7902862e4ba428a90dbc165db141699a8522b..03a7b946bd5448b4b5e471836fd8469bdfc492c8 100644 (file)
@@ -432,6 +432,16 @@ static void *__videobuf_alloc(size_t size)
        return vb;
 }
 
+static void *__videobuf_to_vmalloc (struct videobuf_buffer *buf)
+{
+       struct videobuf_dma_sg_memory *mem = buf->priv;
+       BUG_ON(!mem);
+
+       MAGIC_CHECK(mem->magic, MAGIC_SG_MEM);
+
+       return mem->dma.vmalloc;
+}
+
 static int __videobuf_iolock (struct videobuf_queue* q,
                              struct videobuf_buffer *vb,
                              struct v4l2_framebuffer *fbuf)
@@ -677,6 +687,7 @@ static struct videobuf_qtype_ops sg_ops = {
        .mmap_mapper  = __videobuf_mmap_mapper,
        .video_copy_to_user = __videobuf_copy_to_user,
        .copy_stream  = __videobuf_copy_stream,
+       .vmalloc      = __videobuf_to_vmalloc,
 };
 
 void *videobuf_sg_alloc(size_t size)
index 0f8542a4c71a333facc4f9f56aa4cebf78400168..6e4d73ec6855f274684df7e4b80cea0d4b9b0bd4 100644 (file)
 #include <linux/fs.h>
 #include <linux/kthread.h>
 #include <linux/file.h>
+
 #include <linux/freezer.h>
 
-#include <media/videobuf-dma-sg.h>
+#include <media/videobuf-core.h>
 #include <media/videobuf-dvb.h>
 
 /* ------------------------------------------------------------------ */
@@ -45,7 +46,7 @@ static int videobuf_dvb_thread(void *data)
        struct videobuf_buffer *buf;
        unsigned long flags;
        int err;
-       struct videobuf_dmabuf *dma;
+       void *outp;
 
        dprintk("dvb thread started\n");
        set_freezable();
@@ -66,9 +67,10 @@ static int videobuf_dvb_thread(void *data)
                try_to_freeze();
 
                /* feed buffer data to demux */
-               dma=videobuf_to_dma(buf);
+               outp = videobuf_queue_to_vmalloc (&dvb->dvbq, buf);
+
                if (buf->state == VIDEOBUF_DONE)
-                       dvb_dmx_swfilter(&dvb->demux, dma->vmalloc,
+                       dvb_dmx_swfilter(&dvb->demux, outp,
                                         buf->size);
 
                /* requeue buffer */
index d68d0273807baa3b7b800806dc4b4a76b9e8f618..c91e1d8e38025d32c292d888cac3feeb20103d6d 100644 (file)
@@ -387,6 +387,7 @@ static struct videobuf_qtype_ops qops = {
        .mmap_mapper  = __videobuf_mmap_mapper,
        .video_copy_to_user = __videobuf_copy_to_user,
        .copy_stream  = __videobuf_copy_stream,
+       .vmalloc      = videobuf_to_vmalloc,
 };
 
 void videobuf_queue_vmalloc_init(struct videobuf_queue* q,
index 377a6c6e931b3232080ed4ac33c13338b4753684..5b39a22533fea113254186a9157c9b24f0be5bbf 100644 (file)
@@ -13,6 +13,9 @@
  * the Free Software Foundation; either version 2
  */
 
+#ifndef _VIDEOBUF_CORE_H
+#define _VIDEOBUF_CORE_H
+
 #include <linux/poll.h>
 #ifdef CONFIG_VIDEO_V4L1_COMPAT
 #include <linux/videodev.h>
@@ -123,7 +126,8 @@ struct videobuf_queue_ops {
 struct videobuf_qtype_ops {
        u32                     magic;
 
-       void* (*alloc)          (size_t size);
+       void *(*alloc)          (size_t size);
+       void *(*vmalloc)        (struct videobuf_buffer *buf);
        int (*iolock)           (struct videobuf_queue* q,
                                 struct videobuf_buffer *vb,
                                 struct v4l2_framebuffer *fbuf);
@@ -185,6 +189,10 @@ int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb,
 
 void *videobuf_alloc(struct videobuf_queue* q);
 
+/* Used on videobuf-dvb */
+void *videobuf_queue_to_vmalloc (struct videobuf_queue* q,
+                                struct videobuf_buffer *buf);
+
 void videobuf_queue_core_init(struct videobuf_queue *q,
                         struct videobuf_queue_ops *ops,
                         struct device *dev,
@@ -233,10 +241,4 @@ int videobuf_mmap_free(struct videobuf_queue *q);
 int videobuf_mmap_mapper(struct videobuf_queue *q,
                         struct vm_area_struct *vma);
 
-/* --------------------------------------------------------------------- */
-
-/*
- * Local variables:
- * c-basic-offset: 8
- * End:
- */
+#endif
index ec63ab0fab93eabc848f3d36690abc5a4c6b77c2..aed39460c154cf73a8d8ecb55fe5edd51dec35b9 100644 (file)
@@ -12,6 +12,8 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2
  */
+#ifndef _VIDEOBUF_VMALLOC_H
+#define _VIDEOBUF_VMALLOC_H
 
 #include <media/videobuf-core.h>
 
@@ -39,3 +41,5 @@ void videobuf_queue_vmalloc_init(struct videobuf_queue* q,
 void *videobuf_to_vmalloc (struct videobuf_buffer *buf);
 
 void videobuf_vmalloc_free (struct videobuf_buffer *buf);
+
+#endif