summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backport/backport-include/media/videobuf2-memops.h15
-rw-r--r--backport/compat/compat-3.9.c44
-rw-r--r--patches/collateral-evolutions/media/0002-dma_mmap_coherent-revert.patch36
3 files changed, 33 insertions, 62 deletions
diff --git a/backport/backport-include/media/videobuf2-memops.h b/backport/backport-include/media/videobuf2-memops.h
deleted file mode 100644
index 49d04358..00000000
--- a/backport/backport-include/media/videobuf2-memops.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef __BACKPORT_MEDIA_VB2_MEMOPS_H
-#define __BACKPORT_MEDIA_VB2_MEMOPS_H
-#include_next <media/videobuf2-memops.h>
-#include <linux/version.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) && \
- LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
-#define vb2_mmap_pfn_range LINUX_BACKPORT(vb2_mmap_pfn_range)
-int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr,
- unsigned long size,
- const struct vm_operations_struct *vm_ops,
- void *priv);
-#endif
-
-#endif /* __BACKPORT_MEDIA_VB2_MEMOPS_H */
diff --git a/backport/compat/compat-3.9.c b/backport/compat/compat-3.9.c
index 5ae236c0..f81fe791 100644
--- a/backport/compat/compat-3.9.c
+++ b/backport/compat/compat-3.9.c
@@ -13,50 +13,6 @@
#include <linux/device.h>
#include <linux/err.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-#include <media/videobuf2-memops.h>
-/**
- * vb2_mmap_pfn_range() - map physical pages to userspace
- * @vma: virtual memory region for the mapping
- * @paddr: starting physical address of the memory to be mapped
- * @size: size of the memory to be mapped
- * @vm_ops: vm operations to be assigned to the created area
- * @priv: private data to be associated with the area
- *
- * Returns 0 on success.
- */
-int 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;
-}
-EXPORT_SYMBOL_GPL(vb2_mmap_pfn_range);
-#endif
-
-
#ifdef __sg_page_iter_next
void __sg_page_iter_start(struct sg_page_iter *piter,
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