[media] videobuf2-dma-contig: make cookie() return a pointer to dma_addr_t
authorPawel Osciak <pawel@osciak.com>
Mon, 14 Mar 2011 13:38:24 +0000 (10:38 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 22 Mar 2011 22:41:58 +0000 (19:41 -0300)
dma_addr_t may not fit into void* on some architectures. To be safe, make
vb2_dma_contig_cookie() return a pointer to dma_addr_t and dereference it
in vb2_dma_contig_plane_paddr() back to dma_addr_t.

Signed-off-by: Pawel Osciak <pawel@osciak.com>
Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/videobuf2-dma-contig.c
include/media/videobuf2-dma-contig.h

index 90495b7b4ddfc84e2c70937a90f17ccf2ca5c426..58205d5961386cec699b9c680087619e603f0084 100644 (file)
@@ -78,7 +78,7 @@ static void *vb2_dma_contig_cookie(void *buf_priv)
 {
        struct vb2_dc_buf *buf = buf_priv;
 
-       return (void *)buf->paddr;
+       return &buf->paddr;
 }
 
 static void *vb2_dma_contig_vaddr(void *buf_priv)
index 1d6188d00efd486c4286526f0cc1f3f3485203ed..7e6c68b23773b7d9fa237fbea8d84c085670a9ea 100644 (file)
 #define _MEDIA_VIDEOBUF2_DMA_COHERENT_H
 
 #include <media/videobuf2-core.h>
+#include <linux/dma-mapping.h>
 
-static inline unsigned long vb2_dma_contig_plane_paddr(
-               struct vb2_buffer *vb, unsigned int plane_no)
+static inline dma_addr_t
+vb2_dma_contig_plane_paddr(struct vb2_buffer *vb, unsigned int plane_no)
 {
-       return (unsigned long)vb2_plane_cookie(vb, plane_no);
+       dma_addr_t *paddr = vb2_plane_cookie(vb, plane_no);
+
+       return *paddr;
 }
 
 void *vb2_dma_contig_init_ctx(struct device *dev);