hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/v4l2-core/videobuf-dma-contig.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * helper functions for physically contiguous capture buffers
34 *
....@@ -8,10 +9,6 @@
89 *
910 * Based on videobuf-vmalloc.c,
1011 * (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
1512 */
1613
1714 #include <linux/init.h>
....@@ -172,7 +169,7 @@
172169 mem->size = PAGE_ALIGN(vb->size + offset);
173170 ret = -EINVAL;
174171
175
- down_read(&mm->mmap_sem);
172
+ mmap_read_lock(mm);
176173
177174 vma = find_vma(mm, untagged_baddr);
178175 if (!vma)
....@@ -204,7 +201,7 @@
204201 }
205202
206203 out_up:
207
- up_read(&current->mm->mmap_sem);
204
+ mmap_read_unlock(current->mm);
208205
209206 return ret;
210207 }
....@@ -249,7 +246,7 @@
249246
250247 /* All handling should be done by __videobuf_mmap_mapper() */
251248 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");
253250 return -EINVAL;
254251 }
255252 break;
....@@ -281,7 +278,6 @@
281278 struct videobuf_dma_contig_memory *mem;
282279 struct videobuf_mapping *map;
283280 int retval;
284
- unsigned long size;
285281
286282 dev_dbg(q->dev, "%s\n", __func__);
287283
....@@ -304,7 +300,6 @@
304300 goto error;
305301
306302 /* Try to remap memory */
307
- size = vma->vm_end - vma->vm_start;
308303 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
309304
310305 /* the "vm_pgoff" is just used in v4l2 to find the
....@@ -315,7 +310,7 @@
315310 */
316311 vma->vm_pgoff = 0;
317312
318
- retval = vm_iomap_memory(vma, mem->dma_handle, size);
313
+ retval = vm_iomap_memory(vma, mem->dma_handle, mem->size);
319314 if (retval) {
320315 dev_err(q->dev, "mmap: remap failed with error %d. ",
321316 retval);