| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * helper functions for vmalloc video4linux capture buffers |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * into PAGE_SIZE chunks). They also assume the driver does not need |
|---|
| 7 | 8 | * to touch the video data. |
|---|
| 8 | 9 | * |
|---|
| 9 | | - * (c) 2007 Mauro Carvalho Chehab, <mchehab@kernel.org> |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 12 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 13 | | - * the Free Software Foundation; either version 2 |
|---|
| 10 | + * (c) 2007 Mauro Carvalho Chehab <mchehab@kernel.org> |
|---|
| 14 | 11 | */ |
|---|
| 15 | 12 | |
|---|
| 16 | 13 | #include <linux/init.h> |
|---|
| .. | .. |
|---|
| 18 | 15 | #include <linux/moduleparam.h> |
|---|
| 19 | 16 | #include <linux/slab.h> |
|---|
| 20 | 17 | #include <linux/interrupt.h> |
|---|
| 18 | +#include <linux/pgtable.h> |
|---|
| 21 | 19 | |
|---|
| 22 | 20 | #include <linux/pci.h> |
|---|
| 23 | 21 | #include <linux/vmalloc.h> |
|---|
| 24 | 22 | #include <linux/pagemap.h> |
|---|
| 25 | 23 | #include <asm/page.h> |
|---|
| 26 | | -#include <asm/pgtable.h> |
|---|
| 27 | 24 | |
|---|
| 28 | 25 | #include <media/videobuf-vmalloc.h> |
|---|
| 29 | 26 | |
|---|
| .. | .. |
|---|
| 171 | 168 | |
|---|
| 172 | 169 | /* All handling should be done by __videobuf_mmap_mapper() */ |
|---|
| 173 | 170 | if (!mem->vaddr) { |
|---|
| 174 | | - printk(KERN_ERR "memory is not alloced/mmapped.\n"); |
|---|
| 171 | + printk(KERN_ERR "memory is not allocated/mmapped.\n"); |
|---|
| 175 | 172 | return -EINVAL; |
|---|
| 176 | 173 | } |
|---|
| 177 | 174 | break; |
|---|
| .. | .. |
|---|
| 196 | 193 | } |
|---|
| 197 | 194 | dprintk(1, "vmalloc is at addr %p (%d pages)\n", |
|---|
| 198 | 195 | mem->vaddr, pages); |
|---|
| 199 | | - |
|---|
| 200 | | -#if 0 |
|---|
| 201 | | - int rc; |
|---|
| 202 | | - /* Kernel userptr is used also by read() method. In this case, |
|---|
| 203 | | - there's no need to remap, since data will be copied to user |
|---|
| 204 | | - */ |
|---|
| 205 | | - if (!vb->baddr) |
|---|
| 206 | | - return 0; |
|---|
| 207 | | - |
|---|
| 208 | | - /* FIXME: to properly support USERPTR, remap should occur. |
|---|
| 209 | | - The code below won't work, since mem->vma = NULL |
|---|
| 210 | | - */ |
|---|
| 211 | | - /* Try to remap memory */ |
|---|
| 212 | | - rc = remap_vmalloc_range(mem->vma, (void *)vb->baddr, 0); |
|---|
| 213 | | - if (rc < 0) { |
|---|
| 214 | | - printk(KERN_ERR "mmap: remap failed with error %d", rc); |
|---|
| 215 | | - return -ENOMEM; |
|---|
| 216 | | - } |
|---|
| 217 | | -#endif |
|---|
| 218 | | - |
|---|
| 219 | 196 | break; |
|---|
| 220 | 197 | case V4L2_MEMORY_OVERLAY: |
|---|
| 221 | 198 | default: |
|---|