Re: video-buf warning

From: David S. Miller
Date: Wed Apr 28 2004 - 15:08:14 EST


On Wed, 28 Apr 2004 11:57:38 +0300 (EEST)
Meelis Roos <mroos@xxxxxxxx> wrote:

> CC [M] drivers/media/video/video-buf.o
> drivers/media/video/video-buf.c: In function `videobuf_iolock':
> drivers/media/video/video-buf.c:327: warning: cast from pointer to integer of different size
...
> The specific code is
> /* FIXME: need sanity checks for vb->boff */
> bus = (dma_addr_t)fbuf->base + vb->boff;
>
> bus is dma_addr_t (==u32 on sparc64), base is void*
>
> So if buf->base is really an arbitrary pointer, it might not fit into
> u32. What is it actually?

It is the physical address of a frame buffer, this code is allowing
user programs to point the video capturing to go directly onto a
frame buffer at a specific location.

Using dma_addr_t here is a poor choice, since that data type is to
be used to PCI DMA API interfaces for doing transfers to/from real
memory, not frame buffers and the like :-)

Unfortunately, there is no portable interface available for what
this code wants to do, which is device<-->device DMA transfers.
We would need to create an interface that took two device structures,
and some base+offset values, in order to provide a portable way to
do this, then a reworked version of this user interface would be needed
as well.

In short, it's long term to fix this up, don't worry about it for
now.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/