summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/videobuf-vmalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/videobuf-vmalloc.c')
-rw-r--r--drivers/media/video/videobuf-vmalloc.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/drivers/media/video/videobuf-vmalloc.c b/drivers/media/video/videobuf-vmalloc.c
index 583728f4c221..df142580e44c 100644
--- a/drivers/media/video/videobuf-vmalloc.c
+++ b/drivers/media/video/videobuf-vmalloc.c
@@ -75,7 +75,7 @@ static void videobuf_vm_close(struct vm_area_struct *vma)
struct videobuf_vmalloc_memory *mem;
dprintk(1, "munmap %p q=%p\n", map, q);
- mutex_lock(&q->vb_lock);
+ videobuf_queue_lock(q);
/* We need first to cancel streams, before unmapping */
if (q->streaming)
@@ -102,10 +102,10 @@ static void videobuf_vm_close(struct vm_area_struct *vma)
called with IRQ's disabled
*/
dprintk(1, "%s: buf[%d] freeing (%p)\n",
- __func__, i, mem->vmalloc);
+ __func__, i, mem->vaddr);
- vfree(mem->vmalloc);
- mem->vmalloc = NULL;
+ vfree(mem->vaddr);
+ mem->vaddr = NULL;
}
q->bufs[i]->map = NULL;
@@ -114,7 +114,7 @@ static void videobuf_vm_close(struct vm_area_struct *vma)
kfree(map);
- mutex_unlock(&q->vb_lock);
+ videobuf_queue_unlock(q);
}
return;
@@ -135,7 +135,7 @@ static const struct vm_operations_struct videobuf_vm_ops = {
struct videobuf_dma_sg_memory
*/
-static struct videobuf_buffer *__videobuf_alloc(size_t size)
+static struct videobuf_buffer *__videobuf_alloc_vb(size_t size)
{
struct videobuf_vmalloc_memory *mem;
struct videobuf_buffer *vb;
@@ -170,7 +170,7 @@ static int __videobuf_iolock(struct videobuf_queue *q,
dprintk(1, "%s memory method MMAP\n", __func__);
/* All handling should be done by __videobuf_mmap_mapper() */
- if (!mem->vmalloc) {
+ if (!mem->vaddr) {
printk(KERN_ERR "memory is not alloced/mmapped.\n");
return -EINVAL;
}
@@ -189,13 +189,13 @@ static int __videobuf_iolock(struct videobuf_queue *q,
* read() method.
*/
- mem->vmalloc = vmalloc_user(pages);
- if (!mem->vmalloc) {
+ mem->vaddr = vmalloc_user(pages);
+ if (!mem->vaddr) {
printk(KERN_ERR "vmalloc (%d pages) failed\n", pages);
return -ENOMEM;
}
dprintk(1, "vmalloc is at addr %p (%d pages)\n",
- mem->vmalloc, pages);
+ mem->vaddr, pages);
#if 0
int rc;
@@ -245,8 +245,6 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
return -ENOMEM;
buf->map = map;
- map->start = vma->vm_start;
- map->end = vma->vm_end;
map->q = q;
buf->baddr = vma->vm_start;
@@ -256,18 +254,18 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM);
pages = PAGE_ALIGN(vma->vm_end - vma->vm_start);
- mem->vmalloc = vmalloc_user(pages);
- if (!mem->vmalloc) {
+ mem->vaddr = vmalloc_user(pages);
+ if (!mem->vaddr) {
printk(KERN_ERR "vmalloc (%d pages) failed\n", pages);
goto error;
}
- dprintk(1, "vmalloc is at addr %p (%d pages)\n", mem->vmalloc, pages);
+ dprintk(1, "vmalloc is at addr %p (%d pages)\n", mem->vaddr, pages);
/* Try to remap memory */
- retval = remap_vmalloc_range(vma, mem->vmalloc, 0);
+ retval = remap_vmalloc_range(vma, mem->vaddr, 0);
if (retval < 0) {
printk(KERN_ERR "mmap: remap failed with error %d. ", retval);
- vfree(mem->vmalloc);
+ vfree(mem->vaddr);
goto error;
}
@@ -293,7 +291,7 @@ error:
static struct videobuf_qtype_ops qops = {
.magic = MAGIC_QTYPE_OPS,
- .alloc = __videobuf_alloc,
+ .alloc_vb = __videobuf_alloc_vb,
.iolock = __videobuf_iolock,
.mmap_mapper = __videobuf_mmap_mapper,
.vaddr = videobuf_to_vmalloc,
@@ -306,10 +304,11 @@ void videobuf_queue_vmalloc_init(struct videobuf_queue *q,
enum v4l2_buf_type type,
enum v4l2_field field,
unsigned int msize,
- void *priv)
+ void *priv,
+ struct mutex *ext_lock)
{
videobuf_queue_core_init(q, ops, dev, irqlock, type, field, msize,
- priv, &qops);
+ priv, &qops, ext_lock);
}
EXPORT_SYMBOL_GPL(videobuf_queue_vmalloc_init);
@@ -319,7 +318,7 @@ void *videobuf_to_vmalloc(struct videobuf_buffer *buf)
BUG_ON(!mem);
MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM);
- return mem->vmalloc;
+ return mem->vaddr;
}
EXPORT_SYMBOL_GPL(videobuf_to_vmalloc);
@@ -341,8 +340,8 @@ void videobuf_vmalloc_free(struct videobuf_buffer *buf)
MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM);
- vfree(mem->vmalloc);
- mem->vmalloc = NULL;
+ vfree(mem->vaddr);
+ mem->vaddr = NULL;
return;
}