Skip to content

Commit

Permalink
videobuf2-dma-contig: Only support if HAVE_GENERIC_DMA_COHERENT
Browse files Browse the repository at this point in the history
As reported by Stephen:

> After merging the v4l-dvb tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
>
> ERROR: "dma_common_get_sgtable" [drivers/media/v4l2-core/videobuf2-dma-contig.ko] undefined!
>
> Caused by commit 9ef2cbe ("[media] v4l: vb2-dma-contig: add support
> for DMABUF exporting").  dma_common_get_sgtable() is called from the
> inline dma_get_sgtable_attrs() and dma_get_sgtable_attrs() is "called
> from" dma_get_sgtable().  dma_common_get_sgtable() is only defined if
> ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY is set which depends on
> CONFIG_HAVE_GENERIC_DMA_COHERENT being set which it isn't for this build.

The simplest fix is to just not support DMABUF with vb2-contig, on archs
where this symbol doesn't exist. Some latter patch can rewrite it to
support this outside -arm.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Mauro Carvalho Chehab committed Nov 26, 2012
1 parent 6fa9dd0 commit 93049b9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/media/v4l2-core/videobuf2-dma-contig.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma)
/* DMABUF ops for exporters */
/*********************************************/

#ifdef HAVE_GENERIC_DMA_COHERENT

struct vb2_dc_attachment {
struct sg_table sgt;
enum dma_data_direction dir;
Expand Down Expand Up @@ -416,6 +418,8 @@ static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv)
return dbuf;
}

#endif

/*********************************************/
/* callbacks for USERPTR buffers */
/*********************************************/
Expand Down Expand Up @@ -735,7 +739,9 @@ static void *vb2_dc_attach_dmabuf(void *alloc_ctx, struct dma_buf *dbuf,
const struct vb2_mem_ops vb2_dma_contig_memops = {
.alloc = vb2_dc_alloc,
.put = vb2_dc_put,
#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT
.get_dmabuf = vb2_dc_get_dmabuf,
#endif
.cookie = vb2_dc_cookie,
.vaddr = vb2_dc_vaddr,
.mmap = vb2_dc_mmap,
Expand Down

0 comments on commit 93049b9

Please sign in to comment.