public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
To: video4linux-list@redhat.com
Subject: [PATCH] videobuf-vmallloc: cleanup
Date: Fri, 18 Jul 2008 18:22:25 +0300	[thread overview]
Message-ID: <g5qcfh$clp$1@ger.gmane.org> (raw)

[-- Attachment #1: videobuf-vmalloc_cleanup.patch --]
[-- Type: text/x-patch, Size: 2776 bytes --]

videobuf-vmalloc cleanup:
- remove not used MAGIC_DMABUF define
- remove not needed return;
- remove dead code (#if 0 and etc.)
- remove editor settings
- reorganize __videobuf_mmap_free()

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>

Index: linux-2.6/drivers/media/video/videobuf-vmalloc.c
===================================================================
--- linux-2.6.orig/drivers/media/video/videobuf-vmalloc.c
+++ linux-2.6/drivers/media/video/videobuf-vmalloc.c
@@ -27,7 +27,6 @@
 
 #include <media/videobuf-vmalloc.h>
 
-#define MAGIC_DMABUF   0x17760309
 #define MAGIC_VMAL_MEM 0x18221223
 
 #define MAGIC_CHECK(is,should)	if (unlikely((is) != (should))) \
@@ -46,8 +45,7 @@ MODULE_LICENSE("GPL");
 
 /***************************************************************************/
 
-static void
-videobuf_vm_open(struct vm_area_struct *vma)
+static void videobuf_vm_open(struct vm_area_struct *vma)
 {
 	struct videobuf_mapping *map = vma->vm_private_data;
 
@@ -112,8 +110,6 @@ static void videobuf_vm_close(struct vm_
 
 		mutex_unlock(&q->vb_lock);
 	}
-
-	return;
 }
 
 static struct vm_operations_struct videobuf_vm_ops =
@@ -175,12 +171,10 @@ static int __videobuf_iolock (struct vid
 
 		dprintk(1, "%s memory method USERPTR\n", __func__);
 
-#if 1
 		if (vb->baddr) {
 			printk(KERN_ERR "USERPTR is currently not supported\n");
 			return -EINVAL;
 		}
-#endif
 
 		/* The only USERPTR currently supported is the one needed for
 		   read() method.
@@ -194,25 +188,6 @@ static int __videobuf_iolock (struct vid
 		dprintk(1, "vmalloc is at addr %p (%d pages)\n",
 			mem->vmalloc, pages);
 
-#if 0
-		int rc;
-		/* Kernel userptr is used also by read() method. In this case,
-		   there's no need to remap, since data will be copied to user
-		 */
-		if (!vb->baddr)
-			return 0;
-
-		/* FIXME: to properly support USERPTR, remap should occur.
-		   The code bellow won't work, since mem->vma = NULL
-		 */
-		/* Try to remap memory */
-		rc = remap_vmalloc_range(mem->vma, (void *)vb->baddr, 0);
-		if (rc < 0) {
-			printk(KERN_ERR "mmap: remap failed with error %d. ", rc);
-			return -ENOMEM;
-		}
-#endif
-
 		break;
 	case V4L2_MEMORY_OVERLAY:
 	default:
@@ -237,12 +212,9 @@ static int __videobuf_mmap_free(struct v
 	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;
-		}
-	}
+	for (i = 0; i < VIDEO_MAX_FRAME; i++)
+		if (q->bufs[i] && q->bufs[i]->map)
+			return -EBUSY;
 
 	return 0;
 }
@@ -435,13 +407,5 @@ void videobuf_vmalloc_free (struct video
 
 	vfree(mem->vmalloc);
 	mem->vmalloc = NULL;
-
-	return;
 }
 EXPORT_SYMBOL_GPL(videobuf_vmalloc_free);
-
-/*
- * Local variables:
- * c-basic-offset: 8
- * End:
- */

[-- Attachment #2: Type: text/plain, Size: 164 bytes --]

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

                 reply	other threads:[~2008-07-18 15:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='g5qcfh$clp$1@ger.gmane.org' \
    --to=paulius.zaleckas@teltonika.lt \
    --cc=video4linux-list@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox