'nents' argument of dma_unmap_sg?
Hi
I'm maintaining a driver for the 4.4 branch which makes use of a mapped scatterlist using
count = dma_map_sg(device, sglist, nents, direction);
In the DMA-API-HOWTO.txt documentation (at line 647) is the statement: "The 'nents' argument to the dma_unmap_sg call must be the _same_ one you passed into the dma_map_sg call, it should _NOT_ be the 'count' value _returned_ from the dma_map_sg call."
Thus I would expect to unmap the scatterlist by calling
dma_unmap_sg(device, sglist, nents, direction);
However, in looking at drivers/media/v4l2-core/videobuf-dma-sg.c as a reference example the call to dma_unmap_sg in the videobuf_dma_unmap function uses the number of entries returned by the dma_map_sg call. i.e. It is going against the statement in the DMA-API-HOWTO.txt. That is:
dma_unmap_sg(device, sglist, count, direction);
So my question is which one is the correct use or this a mistake in the documentation? In my implementation I use 'count' as when I used 'nents' I got context page faults on the call to unmapping the memory.
Cheers for any help,
Stuart MacLean
|