Commit 04320dad authored by Russell King's avatar Russell King

[ARM] Take account of vm_pgoff for DMA mmap

The DMA mmap code was ignoring vm_pgoff which prevented a partial
mmap() of a DMA buffer.
Signed-off-by: default avatarRussell King <rmk@arm.linux.org.uk>
parent 7478a481
......@@ -284,13 +284,15 @@ static int dma_mmap(struct device *dev, struct vm_area_struct *vma,
spin_unlock_irqrestore(&consistent_lock, flags);
if (c) {
unsigned long off = vma->vm_pgoff;
kern_size = (c->vm_end - c->vm_start) >> PAGE_SHIFT;
if (vma->vm_pgoff < kern_size &&
user_size <= (kern_size - vma->vm_pgoff)) {
if (off < kern_size &&
user_size <= (kern_size - off)) {
vma->vm_flags |= VM_RESERVED;
ret = remap_pfn_range(vma, vma->vm_start,
page_to_pfn(c->vm_pages),
page_to_pfn(c->vm_pages) + off,
user_size, vma->vm_page_prot);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment