diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-05-14 22:10:39 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-05-14 22:55:47 +0200 |
commit | 50bab3edcff8f8bc51c15f19ecd3e74be9582031 (patch) | |
tree | 4a853157a887ad572e3569f4b35275e6628744f0 /patches/collateral-evolutions/media | |
parent | 0a562da8fe3e543ad09c9c27869c45143e5f7f0b (diff) |
backports: move vb2_mmap_pfn_range into patch
There's only a single user of vb2_mmap_pfn_range() and
at least on 3.2 having the function in compat-3.9.c is
problematic if CPTCFG_BACKPORT_BUILD_DMA_SHARED_BUFFER
isn't set, because on that kernel there's no dma-buf.h
and then compilation can fail.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'patches/collateral-evolutions/media')
-rw-r--r-- | patches/collateral-evolutions/media/0002-dma_mmap_coherent-revert.patch | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/patches/collateral-evolutions/media/0002-dma_mmap_coherent-revert.patch b/patches/collateral-evolutions/media/0002-dma_mmap_coherent-revert.patch index 4d3a77ee..2a6f51aa 100644 --- a/patches/collateral-evolutions/media/0002-dma_mmap_coherent-revert.patch +++ b/patches/collateral-evolutions/media/0002-dma_mmap_coherent-revert.patch @@ -25,12 +25,42 @@ Date: Thu Jun 14 11:32:21 2012 -0300 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c -@@ -186,6 +186,22 @@ static void *vb2_dc_alloc(void *alloc_ct +@@ -186,6 +186,52 @@ static void *vb2_dc_alloc(void *alloc_ct return buf; } +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) ++static int ++backport_vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr, ++ unsigned long size, ++ const struct vm_operations_struct *vm_ops, ++ void *priv) ++{ ++ int ret; ++ ++ size = min_t(unsigned long, vma->vm_end - vma->vm_start, size); ++ ++ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); ++ ret = remap_pfn_range(vma, vma->vm_start, paddr >> PAGE_SHIFT, ++ size, vma->vm_page_prot); ++ if (ret) { ++ printk(KERN_ERR "Remapping memory failed, error: %d\n", ret); ++ return ret; ++ } ++ ++ vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; ++ vma->vm_private_data = priv; ++ vma->vm_ops = vm_ops; ++ ++ vma->vm_ops->open(vma); ++ ++ pr_debug("%s: mapped paddr 0x%08lx at 0x%08lx, size %ld\n", ++ __func__, paddr, vma->vm_start, size); ++ ++ return 0; ++} ++ +static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma) +{ + struct vb2_dc_buf *buf = buf_priv; @@ -40,8 +70,8 @@ Date: Thu Jun 14 11:32:21 2012 -0300 + return -EINVAL; + } + -+ return vb2_mmap_pfn_range(vma, buf->dma_addr, buf->size, -+ &vb2_common_vm_ops, &buf->handler); ++ return backport_vb2_mmap_pfn_range(vma, buf->dma_addr, buf->size, ++ &vb2_common_vm_ops, &buf->handler); +} +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */ +#else |