linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [media] vb2-vmalloc: Protect DMA-specific code by #ifdef CONFIG_HAS_DMA
@ 2014-12-15 13:40 Geert Uytterhoeven
  2014-12-16 11:00 ` Marek Szyprowski
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2014-12-15 13:40 UTC (permalink / raw)
  To: Hans Verkuil, Pawel Osciak, Marek Szyprowski, Kyungmin Park,
	Mauro Carvalho Chehab
  Cc: linux-media, linux-kernel, Geert Uytterhoeven

If NO_DMA=y:

drivers/built-in.o: In function `vb2_vmalloc_dmabuf_ops_detach':
videobuf2-vmalloc.c:(.text+0x6f11b0): undefined reference to `dma_unmap_sg'
drivers/built-in.o: In function `vb2_vmalloc_dmabuf_ops_map':
videobuf2-vmalloc.c:(.text+0x6f1266): undefined reference to `dma_unmap_sg'
videobuf2-vmalloc.c:(.text+0x6f1282): undefined reference to `dma_map_sg'

As we don't want to make the core VIDEOBUF2_VMALLOC depend on HAS_DMA
(it's v4l2 core code, and selected by a lot of drivers), stub out the
DMA support if HAS_DMA is not set.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/media/v4l2-core/videobuf2-vmalloc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/v4l2-core/videobuf2-vmalloc.c b/drivers/media/v4l2-core/videobuf2-vmalloc.c
index fba944e502271069..d4fe55c85e0c5e71 100644
--- a/drivers/media/v4l2-core/videobuf2-vmalloc.c
+++ b/drivers/media/v4l2-core/videobuf2-vmalloc.c
@@ -211,6 +211,7 @@ static int vb2_vmalloc_mmap(void *buf_priv, struct vm_area_struct *vma)
 	return 0;
 }
 
+#ifdef CONFIG_HAS_DMA
 /*********************************************/
 /*         DMABUF ops for exporters          */
 /*********************************************/
@@ -380,6 +381,8 @@ static struct dma_buf *vb2_vmalloc_get_dmabuf(void *buf_priv, unsigned long flag
 
 	return dbuf;
 }
+#endif /* CONFIG_HAS_DMA */
+
 
 /*********************************************/
 /*       callbacks for DMABUF buffers        */
@@ -437,7 +440,9 @@ const struct vb2_mem_ops vb2_vmalloc_memops = {
 	.put		= vb2_vmalloc_put,
 	.get_userptr	= vb2_vmalloc_get_userptr,
 	.put_userptr	= vb2_vmalloc_put_userptr,
+#ifdef CONFIG_HAS_DMA
 	.get_dmabuf	= vb2_vmalloc_get_dmabuf,
+#endif
 	.map_dmabuf	= vb2_vmalloc_map_dmabuf,
 	.unmap_dmabuf	= vb2_vmalloc_unmap_dmabuf,
 	.attach_dmabuf	= vb2_vmalloc_attach_dmabuf,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] [media] vb2-vmalloc: Protect DMA-specific code by #ifdef CONFIG_HAS_DMA
  2014-12-15 13:40 [PATCH] [media] vb2-vmalloc: Protect DMA-specific code by #ifdef CONFIG_HAS_DMA Geert Uytterhoeven
@ 2014-12-16 11:00 ` Marek Szyprowski
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Szyprowski @ 2014-12-16 11:00 UTC (permalink / raw)
  To: Geert Uytterhoeven, Hans Verkuil, Pawel Osciak, Kyungmin Park,
	Mauro Carvalho Chehab
  Cc: linux-media, linux-kernel

Hello,

On 2014-12-15 14:40, Geert Uytterhoeven wrote:
> If NO_DMA=y:
>
> drivers/built-in.o: In function `vb2_vmalloc_dmabuf_ops_detach':
> videobuf2-vmalloc.c:(.text+0x6f11b0): undefined reference to `dma_unmap_sg'
> drivers/built-in.o: In function `vb2_vmalloc_dmabuf_ops_map':
> videobuf2-vmalloc.c:(.text+0x6f1266): undefined reference to `dma_unmap_sg'
> videobuf2-vmalloc.c:(.text+0x6f1282): undefined reference to `dma_map_sg'
>
> As we don't want to make the core VIDEOBUF2_VMALLOC depend on HAS_DMA
> (it's v4l2 core code, and selected by a lot of drivers), stub out the
> DMA support if HAS_DMA is not set.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---
>   drivers/media/v4l2-core/videobuf2-vmalloc.c | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/drivers/media/v4l2-core/videobuf2-vmalloc.c b/drivers/media/v4l2-core/videobuf2-vmalloc.c
> index fba944e502271069..d4fe55c85e0c5e71 100644
> --- a/drivers/media/v4l2-core/videobuf2-vmalloc.c
> +++ b/drivers/media/v4l2-core/videobuf2-vmalloc.c
> @@ -211,6 +211,7 @@ static int vb2_vmalloc_mmap(void *buf_priv, struct vm_area_struct *vma)
>   	return 0;
>   }
>   
> +#ifdef CONFIG_HAS_DMA
>   /*********************************************/
>   /*         DMABUF ops for exporters          */
>   /*********************************************/
> @@ -380,6 +381,8 @@ static struct dma_buf *vb2_vmalloc_get_dmabuf(void *buf_priv, unsigned long flag
>   
>   	return dbuf;
>   }
> +#endif /* CONFIG_HAS_DMA */
> +
>   
>   /*********************************************/
>   /*       callbacks for DMABUF buffers        */
> @@ -437,7 +440,9 @@ const struct vb2_mem_ops vb2_vmalloc_memops = {
>   	.put		= vb2_vmalloc_put,
>   	.get_userptr	= vb2_vmalloc_get_userptr,
>   	.put_userptr	= vb2_vmalloc_put_userptr,
> +#ifdef CONFIG_HAS_DMA
>   	.get_dmabuf	= vb2_vmalloc_get_dmabuf,
> +#endif
>   	.map_dmabuf	= vb2_vmalloc_map_dmabuf,
>   	.unmap_dmabuf	= vb2_vmalloc_unmap_dmabuf,
>   	.attach_dmabuf	= vb2_vmalloc_attach_dmabuf,

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-16 11:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-15 13:40 [PATCH] [media] vb2-vmalloc: Protect DMA-specific code by #ifdef CONFIG_HAS_DMA Geert Uytterhoeven
2014-12-16 11:00 ` Marek Szyprowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).