diff options
Diffstat (limited to 'drivers/media/platform/omap/omap_vout.c')
-rw-r--r-- | drivers/media/platform/omap/omap_vout.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c index dade3ceab092..96c4a17e4280 100644 --- a/drivers/media/platform/omap/omap_vout.c +++ b/drivers/media/platform/omap/omap_vout.c | |||
@@ -205,19 +205,21 @@ static u32 omap_vout_uservirt_to_phys(u32 virtp) | |||
205 | struct vm_area_struct *vma; | 205 | struct vm_area_struct *vma; |
206 | struct mm_struct *mm = current->mm; | 206 | struct mm_struct *mm = current->mm; |
207 | 207 | ||
208 | vma = find_vma(mm, virtp); | ||
209 | /* For kernel direct-mapped memory, take the easy way */ | 208 | /* For kernel direct-mapped memory, take the easy way */ |
210 | if (virtp >= PAGE_OFFSET) { | 209 | if (virtp >= PAGE_OFFSET) |
211 | physp = virt_to_phys((void *) virtp); | 210 | return virt_to_phys((void *) virtp); |
212 | } else if (vma && (vma->vm_flags & VM_IO) && vma->vm_pgoff) { | 211 | |
212 | down_read(¤t->mm->mmap_sem); | ||
213 | vma = find_vma(mm, virtp); | ||
214 | if (vma && (vma->vm_flags & VM_IO) && vma->vm_pgoff) { | ||
213 | /* this will catch, kernel-allocated, mmaped-to-usermode | 215 | /* this will catch, kernel-allocated, mmaped-to-usermode |
214 | addresses */ | 216 | addresses */ |
215 | physp = (vma->vm_pgoff << PAGE_SHIFT) + (virtp - vma->vm_start); | 217 | physp = (vma->vm_pgoff << PAGE_SHIFT) + (virtp - vma->vm_start); |
218 | up_read(¤t->mm->mmap_sem); | ||
216 | } else { | 219 | } else { |
217 | /* otherwise, use get_user_pages() for general userland pages */ | 220 | /* otherwise, use get_user_pages() for general userland pages */ |
218 | int res, nr_pages = 1; | 221 | int res, nr_pages = 1; |
219 | struct page *pages; | 222 | struct page *pages; |
220 | down_read(¤t->mm->mmap_sem); | ||
221 | 223 | ||
222 | res = get_user_pages(current, current->mm, virtp, nr_pages, 1, | 224 | res = get_user_pages(current, current->mm, virtp, nr_pages, 1, |
223 | 0, &pages, NULL); | 225 | 0, &pages, NULL); |