V4L/DVB: v4l videobuf: remove mmap_free callback
authorHans Verkuil <hverkuil@xs4all.nl>
Sun, 28 Mar 2010 10:54:29 +0000 (07:54 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 19 May 2010 15:57:50 +0000 (12:57 -0300)
Remove the mmap_free callback from struct videobuf_qtype_ops.

All implementations of this callback do the same trivial check: return
-EBUSY if any buffer is mmapped. That can also be tested in the
videobuf core.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/videobuf-core.c
drivers/media/video/videobuf-dma-contig.c
drivers/media/video/videobuf-dma-sg.c
drivers/media/video/videobuf-vmalloc.c
include/media/videobuf-core.h

index 63d7043502d683c9ba5bc9fea3290b8bc8a58ad0..52bb74b18a68aa5e83bc45cea38f67bcb084568e 100644 (file)
@@ -311,20 +311,18 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b,
 static int __videobuf_mmap_free(struct videobuf_queue *q)
 {
        int i;
-       int rc;
 
        if (!q)
                return 0;
 
        MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);
 
-       rc = CALL(q, mmap_free, q);
+       for (i = 0; i < VIDEO_MAX_FRAME; i++)
+               if (q->bufs[i] && q->bufs[i]->map)
+                       return -EBUSY;
 
        q->is_mmapped = 0;
 
-       if (rc < 0)
-               return rc;
-
        for (i = 0; i < VIDEO_MAX_FRAME; i++) {
                if (NULL == q->bufs[i])
                        continue;
@@ -333,7 +331,7 @@ static int __videobuf_mmap_free(struct videobuf_queue *q)
                q->bufs[i] = NULL;
        }
 
-       return rc;
+       return 0;
 }
 
 int videobuf_mmap_free(struct videobuf_queue *q)
index dce4f3aa4af1adc1f77aee4d58484a6b13b38f40..0a32cf810c88d2c8fa3c44032ba363dbb45651e1 100644 (file)
@@ -263,19 +263,6 @@ static int __videobuf_iolock(struct videobuf_queue *q,
        return 0;
 }
 
-static int __videobuf_mmap_free(struct videobuf_queue *q)
-{
-       unsigned int i;
-
-       dev_dbg(q->dev, "%s\n", __func__);
-       for (i = 0; i < VIDEO_MAX_FRAME; i++) {
-               if (q->bufs[i] && q->bufs[i]->map)
-                       return -EBUSY;
-       }
-
-       return 0;
-}
-
 static int __videobuf_mmap_mapper(struct videobuf_queue *q,
                                  struct vm_area_struct *vma)
 {
@@ -424,7 +411,6 @@ static struct videobuf_qtype_ops qops = {
 
        .alloc        = __videobuf_alloc,
        .iolock       = __videobuf_iolock,
-       .mmap_free    = __videobuf_mmap_free,
        .mmap_mapper  = __videobuf_mmap_mapper,
        .video_copy_to_user = __videobuf_copy_to_user,
        .copy_stream  = __videobuf_copy_stream,
index c9d946a388e88f0bf9cc887aa2fab105dd27f43a..7ff275e30092a83ee80cabebccd3c3bb61bfe4cd 100644 (file)
@@ -548,20 +548,6 @@ static int __videobuf_sync(struct videobuf_queue *q,
        return videobuf_dma_sync(q, &mem->dma);
 }
 
-static int __videobuf_mmap_free(struct videobuf_queue *q)
-{
-       int i;
-
-       for (i = 0; i < VIDEO_MAX_FRAME; i++) {
-               if (q->bufs[i]) {
-                       if (q->bufs[i]->map)
-                               return -EBUSY;
-               }
-       }
-
-       return 0;
-}
-
 static int __videobuf_mmap_mapper(struct videobuf_queue *q,
                         struct vm_area_struct *vma)
 {
@@ -711,7 +697,6 @@ static struct videobuf_qtype_ops sg_ops = {
        .alloc        = __videobuf_alloc,
        .iolock       = __videobuf_iolock,
        .sync         = __videobuf_sync,
-       .mmap_free    = __videobuf_mmap_free,
        .mmap_mapper  = __videobuf_mmap_mapper,
        .video_copy_to_user = __videobuf_copy_to_user,
        .copy_stream  = __videobuf_copy_stream,
index d6a8a38dc9cb6bf5fe9ced21cbb5f832c7baa429..43c92882e4c567cb34248761705df29f88af4e69 100644 (file)
@@ -235,21 +235,6 @@ static int __videobuf_sync(struct videobuf_queue *q,
        return 0;
 }
 
-static int __videobuf_mmap_free(struct videobuf_queue *q)
-{
-       unsigned int i;
-
-       dprintk(1, "%s\n", __func__);
-       for (i = 0; i < VIDEO_MAX_FRAME; i++) {
-               if (q->bufs[i]) {
-                       if (q->bufs[i]->map)
-                               return -EBUSY;
-               }
-       }
-
-       return 0;
-}
-
 static int __videobuf_mmap_mapper(struct videobuf_queue *q,
                         struct vm_area_struct *vma)
 {
@@ -385,7 +370,6 @@ static struct videobuf_qtype_ops qops = {
        .alloc        = __videobuf_alloc,
        .iolock       = __videobuf_iolock,
        .sync         = __videobuf_sync,
-       .mmap_free    = __videobuf_mmap_free,
        .mmap_mapper  = __videobuf_mmap_mapper,
        .video_copy_to_user = __videobuf_copy_to_user,
        .copy_stream  = __videobuf_copy_stream,
index 3896e29a652d6a890b3f462f0b60a52950f618b4..345ec5a45c55c64172aeb14a3676b8f1fb03d6b4 100644 (file)
@@ -144,7 +144,6 @@ struct videobuf_qtype_ops {
                                 size_t pos,
                                 int vbihack,
                                 int nonblocking);
-       int (*mmap_free)        (struct videobuf_queue *q);
        int (*mmap_mapper)      (struct videobuf_queue *q,
                                struct vm_area_struct *vma);
 };