Skip to contentSkip to conversation

videobuf-vmallloc: cleanup

PATCH New Paulius Zaleckas 1 participant 1 message Jul 18, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 videobuf-vmallloc: cleanup

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()

drivers/media/video/videobuf-vmalloc.c +4 -40
Index: 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:
- */

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list