.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * helper functions for physically contiguous capture buffers |
---|
3 | 4 | * |
---|
.. | .. |
---|
8 | 9 | * |
---|
9 | 10 | * Based on videobuf-vmalloc.c, |
---|
10 | 11 | * (c) 2007 Mauro Carvalho Chehab, <mchehab@kernel.org> |
---|
11 | | - * |
---|
12 | | - * This program is free software; you can redistribute it and/or modify |
---|
13 | | - * it under the terms of the GNU General Public License as published by |
---|
14 | | - * the Free Software Foundation; either version 2 |
---|
15 | 12 | */ |
---|
16 | 13 | |
---|
17 | 14 | #include <linux/init.h> |
---|
.. | .. |
---|
172 | 169 | mem->size = PAGE_ALIGN(vb->size + offset); |
---|
173 | 170 | ret = -EINVAL; |
---|
174 | 171 | |
---|
175 | | - down_read(&mm->mmap_sem); |
---|
| 172 | + mmap_read_lock(mm); |
---|
176 | 173 | |
---|
177 | 174 | vma = find_vma(mm, untagged_baddr); |
---|
178 | 175 | if (!vma) |
---|
.. | .. |
---|
204 | 201 | } |
---|
205 | 202 | |
---|
206 | 203 | out_up: |
---|
207 | | - up_read(¤t->mm->mmap_sem); |
---|
| 204 | + mmap_read_unlock(current->mm); |
---|
208 | 205 | |
---|
209 | 206 | return ret; |
---|
210 | 207 | } |
---|
.. | .. |
---|
249 | 246 | |
---|
250 | 247 | /* All handling should be done by __videobuf_mmap_mapper() */ |
---|
251 | 248 | if (!mem->vaddr) { |
---|
252 | | - dev_err(q->dev, "memory is not alloced/mmapped.\n"); |
---|
| 249 | + dev_err(q->dev, "memory is not allocated/mmapped.\n"); |
---|
253 | 250 | return -EINVAL; |
---|
254 | 251 | } |
---|
255 | 252 | break; |
---|
.. | .. |
---|
281 | 278 | struct videobuf_dma_contig_memory *mem; |
---|
282 | 279 | struct videobuf_mapping *map; |
---|
283 | 280 | int retval; |
---|
284 | | - unsigned long size; |
---|
285 | 281 | |
---|
286 | 282 | dev_dbg(q->dev, "%s\n", __func__); |
---|
287 | 283 | |
---|
.. | .. |
---|
304 | 300 | goto error; |
---|
305 | 301 | |
---|
306 | 302 | /* Try to remap memory */ |
---|
307 | | - size = vma->vm_end - vma->vm_start; |
---|
308 | 303 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
---|
309 | 304 | |
---|
310 | 305 | /* the "vm_pgoff" is just used in v4l2 to find the |
---|
.. | .. |
---|
315 | 310 | */ |
---|
316 | 311 | vma->vm_pgoff = 0; |
---|
317 | 312 | |
---|
318 | | - retval = vm_iomap_memory(vma, mem->dma_handle, size); |
---|
| 313 | + retval = vm_iomap_memory(vma, mem->dma_handle, mem->size); |
---|
319 | 314 | if (retval) { |
---|
320 | 315 | dev_err(q->dev, "mmap: remap failed with error %d. ", |
---|
321 | 316 | retval); |
---|