diff options
Diffstat (limited to 'drivers/media/video/videobuf-vmalloc.c')
-rw-r--r-- | drivers/media/video/videobuf-vmalloc.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/drivers/media/video/videobuf-vmalloc.c b/drivers/media/video/videobuf-vmalloc.c index 583728f4c221..e7fe31d54f07 100644 --- a/drivers/media/video/videobuf-vmalloc.c +++ b/drivers/media/video/videobuf-vmalloc.c | |||
@@ -102,10 +102,10 @@ static void videobuf_vm_close(struct vm_area_struct *vma) | |||
102 | called with IRQ's disabled | 102 | called with IRQ's disabled |
103 | */ | 103 | */ |
104 | dprintk(1, "%s: buf[%d] freeing (%p)\n", | 104 | dprintk(1, "%s: buf[%d] freeing (%p)\n", |
105 | __func__, i, mem->vmalloc); | 105 | __func__, i, mem->vaddr); |
106 | 106 | ||
107 | vfree(mem->vmalloc); | 107 | vfree(mem->vaddr); |
108 | mem->vmalloc = NULL; | 108 | mem->vaddr = NULL; |
109 | } | 109 | } |
110 | 110 | ||
111 | q->bufs[i]->map = NULL; | 111 | q->bufs[i]->map = NULL; |
@@ -135,7 +135,7 @@ static const struct vm_operations_struct videobuf_vm_ops = { | |||
135 | struct videobuf_dma_sg_memory | 135 | struct videobuf_dma_sg_memory |
136 | */ | 136 | */ |
137 | 137 | ||
138 | static struct videobuf_buffer *__videobuf_alloc(size_t size) | 138 | static struct videobuf_buffer *__videobuf_alloc_vb(size_t size) |
139 | { | 139 | { |
140 | struct videobuf_vmalloc_memory *mem; | 140 | struct videobuf_vmalloc_memory *mem; |
141 | struct videobuf_buffer *vb; | 141 | struct videobuf_buffer *vb; |
@@ -170,7 +170,7 @@ static int __videobuf_iolock(struct videobuf_queue *q, | |||
170 | dprintk(1, "%s memory method MMAP\n", __func__); | 170 | dprintk(1, "%s memory method MMAP\n", __func__); |
171 | 171 | ||
172 | /* All handling should be done by __videobuf_mmap_mapper() */ | 172 | /* All handling should be done by __videobuf_mmap_mapper() */ |
173 | if (!mem->vmalloc) { | 173 | if (!mem->vaddr) { |
174 | printk(KERN_ERR "memory is not alloced/mmapped.\n"); | 174 | printk(KERN_ERR "memory is not alloced/mmapped.\n"); |
175 | return -EINVAL; | 175 | return -EINVAL; |
176 | } | 176 | } |
@@ -189,13 +189,13 @@ static int __videobuf_iolock(struct videobuf_queue *q, | |||
189 | * read() method. | 189 | * read() method. |
190 | */ | 190 | */ |
191 | 191 | ||
192 | mem->vmalloc = vmalloc_user(pages); | 192 | mem->vaddr = vmalloc_user(pages); |
193 | if (!mem->vmalloc) { | 193 | if (!mem->vaddr) { |
194 | printk(KERN_ERR "vmalloc (%d pages) failed\n", pages); | 194 | printk(KERN_ERR "vmalloc (%d pages) failed\n", pages); |
195 | return -ENOMEM; | 195 | return -ENOMEM; |
196 | } | 196 | } |
197 | dprintk(1, "vmalloc is at addr %p (%d pages)\n", | 197 | dprintk(1, "vmalloc is at addr %p (%d pages)\n", |
198 | mem->vmalloc, pages); | 198 | mem->vaddr, pages); |
199 | 199 | ||
200 | #if 0 | 200 | #if 0 |
201 | int rc; | 201 | int rc; |
@@ -245,8 +245,6 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, | |||
245 | return -ENOMEM; | 245 | return -ENOMEM; |
246 | 246 | ||
247 | buf->map = map; | 247 | buf->map = map; |
248 | map->start = vma->vm_start; | ||
249 | map->end = vma->vm_end; | ||
250 | map->q = q; | 248 | map->q = q; |
251 | 249 | ||
252 | buf->baddr = vma->vm_start; | 250 | buf->baddr = vma->vm_start; |
@@ -256,18 +254,18 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, | |||
256 | MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM); | 254 | MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM); |
257 | 255 | ||
258 | pages = PAGE_ALIGN(vma->vm_end - vma->vm_start); | 256 | pages = PAGE_ALIGN(vma->vm_end - vma->vm_start); |
259 | mem->vmalloc = vmalloc_user(pages); | 257 | mem->vaddr = vmalloc_user(pages); |
260 | if (!mem->vmalloc) { | 258 | if (!mem->vaddr) { |
261 | printk(KERN_ERR "vmalloc (%d pages) failed\n", pages); | 259 | printk(KERN_ERR "vmalloc (%d pages) failed\n", pages); |
262 | goto error; | 260 | goto error; |
263 | } | 261 | } |
264 | dprintk(1, "vmalloc is at addr %p (%d pages)\n", mem->vmalloc, pages); | 262 | dprintk(1, "vmalloc is at addr %p (%d pages)\n", mem->vaddr, pages); |
265 | 263 | ||
266 | /* Try to remap memory */ | 264 | /* Try to remap memory */ |
267 | retval = remap_vmalloc_range(vma, mem->vmalloc, 0); | 265 | retval = remap_vmalloc_range(vma, mem->vaddr, 0); |
268 | if (retval < 0) { | 266 | if (retval < 0) { |
269 | printk(KERN_ERR "mmap: remap failed with error %d. ", retval); | 267 | printk(KERN_ERR "mmap: remap failed with error %d. ", retval); |
270 | vfree(mem->vmalloc); | 268 | vfree(mem->vaddr); |
271 | goto error; | 269 | goto error; |
272 | } | 270 | } |
273 | 271 | ||
@@ -293,7 +291,7 @@ error: | |||
293 | static struct videobuf_qtype_ops qops = { | 291 | static struct videobuf_qtype_ops qops = { |
294 | .magic = MAGIC_QTYPE_OPS, | 292 | .magic = MAGIC_QTYPE_OPS, |
295 | 293 | ||
296 | .alloc = __videobuf_alloc, | 294 | .alloc_vb = __videobuf_alloc_vb, |
297 | .iolock = __videobuf_iolock, | 295 | .iolock = __videobuf_iolock, |
298 | .mmap_mapper = __videobuf_mmap_mapper, | 296 | .mmap_mapper = __videobuf_mmap_mapper, |
299 | .vaddr = videobuf_to_vmalloc, | 297 | .vaddr = videobuf_to_vmalloc, |
@@ -319,7 +317,7 @@ void *videobuf_to_vmalloc(struct videobuf_buffer *buf) | |||
319 | BUG_ON(!mem); | 317 | BUG_ON(!mem); |
320 | MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM); | 318 | MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM); |
321 | 319 | ||
322 | return mem->vmalloc; | 320 | return mem->vaddr; |
323 | } | 321 | } |
324 | EXPORT_SYMBOL_GPL(videobuf_to_vmalloc); | 322 | EXPORT_SYMBOL_GPL(videobuf_to_vmalloc); |
325 | 323 | ||
@@ -341,8 +339,8 @@ void videobuf_vmalloc_free(struct videobuf_buffer *buf) | |||
341 | 339 | ||
342 | MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM); | 340 | MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM); |
343 | 341 | ||
344 | vfree(mem->vmalloc); | 342 | vfree(mem->vaddr); |
345 | mem->vmalloc = NULL; | 343 | mem->vaddr = NULL; |
346 | 344 | ||
347 | return; | 345 | return; |
348 | } | 346 | } |