backports: do not use dma_buf_vmap() on kernel < 3.5
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 27 Jul 2014 20:44:02 +0000 (22:44 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 27 Jul 2014 21:48:59 +0000 (23:48 +0200)
The dma function dma_buf_vmap() is not available on kernel < 3.5,
remove the call from the media subsystem code.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
patches/collateral-evolutions/media/0002-no_dmabuf/v4l2.patch

index 218dc25f9ec3e16e04d86ddb6b7331fff883fc17..cb774427cc85cc1a39424fbf9ac33472b4e2ac00 100644 (file)
  
 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c
 +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c
-@@ -267,6 +267,7 @@ static int vb2_dc_mmap(void *buf_priv, s
+@@ -98,8 +98,10 @@ static void *vb2_dc_vaddr(void *buf_priv
+ {
+       struct vb2_dc_buf *buf = buf_priv;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
+       if (!buf->vaddr && buf->db_attach)
+               buf->vaddr = dma_buf_vmap(buf->db_attach->dmabuf);
++#endif
+       return buf->vaddr;
+ }
+@@ -270,6 +272,7 @@ static int vb2_dc_mmap(void *buf_priv, s
  }
  #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)) */
  
  /*********************************************/
  /*       callbacks for DMABUF buffers        */
  /*********************************************/
-@@ -849,6 +852,7 @@ static void *vb2_dc_attach_dmabuf(void *
+@@ -857,6 +862,7 @@ static void *vb2_dc_attach_dmabuf(void *
  
        return buf;
  }
  
  /*********************************************/
  /*       DMA CONTIG exported functions       */
-@@ -857,7 +861,9 @@ static void *vb2_dc_attach_dmabuf(void *
+@@ -865,7 +871,9 @@ static void *vb2_dc_attach_dmabuf(void *
  const struct vb2_mem_ops vb2_dma_contig_memops = {
        .alloc          = vb2_dc_alloc,
        .put            = vb2_dc_put,
        .cookie         = vb2_dc_cookie,
        .vaddr          = vb2_dc_vaddr,
        .mmap           = vb2_dc_mmap,
-@@ -865,10 +871,12 @@ const struct vb2_mem_ops vb2_dma_contig_
+@@ -873,10 +881,12 @@ const struct vb2_mem_ops vb2_dma_contig_
        .put_userptr    = vb2_dc_put_userptr,
        .prepare        = vb2_dc_prepare,
        .finish         = vb2_dc_finish,