aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/videobuf-vmalloc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-04 13:38:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-04 13:38:08 -0400
commitf63b759c44b0561c76a67894c734157df3313b42 (patch)
tree4e9638f6c1aa5c0faa62ad4213282cc7cb39772a /drivers/media/video/videobuf-vmalloc.c
parent4a35cee066df1b1958e25e71595b3845d06b192e (diff)
parent844a9e93d7fcd910cd94f6eb262e2cc43cacbe56 (diff)
Merge branch 'v4l_for_2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'v4l_for_2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (243 commits) V4L/DVB: sms: Convert IR support to use the Remote Controller core V4L/DVB: sms: properly initialize IR phys and IR name V4L/DVB: standardize names at rc-dib0700 tables V4L/DVB: smsusb: enable IR port for Hauppauge WinTV MiniStick V4L/DVB: dib0700: Fix RC protocol logic to properly handle NEC/NECx and RC-5 V4L/DVB: dib0700: properly implement IR change_protocol V4L/DVB: dib0700: break keytable into NEC and RC-5 variants V4L/DVB: dib0700: avoid bad repeat V4L/DVB: Port dib0700 to rc-core V4L/DVB: Add a keymap file with dib0700 table V4L/DVB: dvb-usb: add support for rc-core mode V4L/DVB: dvb-usb: prepare drivers for using rc-core V4L/DVB: dvb-usb: get rid of struct dvb_usb_rc_key V4L/DVB: rj54n1cb0c: fix a comment in the driver V4L/DVB: V4L2: sh_vou: VOU does support the full PAL resolution too V4L/DVB: V4L2: sh_mobile_camera_ceu: add support for CSI2 V4L/DVB: V4L2: soc-camera: add a MIPI CSI-2 driver for SH-Mobile platforms V4L/DVB: V4L2: soc-camera: export soc-camera bus type for notifications V4L/DVB: V4L2: mediabus: add 12-bit Bayer and YUV420 pixel formats V4L/DVB: mediabus: fix ambiguous pixel code names ...
Diffstat (limited to 'drivers/media/video/videobuf-vmalloc.c')
-rw-r--r--drivers/media/video/videobuf-vmalloc.c36
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
138static struct videobuf_buffer *__videobuf_alloc(size_t size) 138static 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:
293static struct videobuf_qtype_ops qops = { 291static 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}
324EXPORT_SYMBOL_GPL(videobuf_to_vmalloc); 322EXPORT_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}