summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/tegra
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-09-24 16:14:04 +0200
committerThierry Reding <treding@nvidia.com>2014-11-13 16:14:48 +0100
commit53ea72132df8dd62bb77b28df7b05074dcea96fe (patch)
tree048176e8f160f33f2bc1d3dfad5f4d7aa17cbd8b /drivers/gpu/drm/tegra
parente55a8bd8ead046e5b7f78c321afc7594034257f9 (diff)
drm/tegra: gem: Use dma_mmap_writecombine()
Use the existing API rather than open-coding equivalent functionality in the driver. Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/tegra')
-rw-r--r--drivers/gpu/drm/tegra/gem.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index a42d4c9a4d7d..9905598ebfc4 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -306,6 +306,7 @@ const struct vm_operations_struct tegra_bo_vm_ops = {
int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma)
{
+ unsigned long vm_pgoff = vma->vm_pgoff;
struct drm_gem_object *gem;
struct tegra_bo *bo;
int ret;
@@ -317,12 +318,19 @@ int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma)
gem = vma->vm_private_data;
bo = to_tegra_bo(gem);
- ret = remap_pfn_range(vma, vma->vm_start, bo->paddr >> PAGE_SHIFT,
- vma->vm_end - vma->vm_start, vma->vm_page_prot);
- if (ret)
+ vma->vm_flags &= ~VM_PFNMAP;
+ vma->vm_pgoff = 0;
+
+ ret = dma_mmap_writecombine(gem->dev->dev, vma, bo->vaddr, bo->paddr,
+ gem->size);
+ if (ret) {
drm_gem_vm_close(vma);
+ return ret;
+ }
+
+ vma->vm_pgoff = vm_pgoff;
- return ret;
+ return 0;
}
static struct sg_table *