Now we have a contradiction between two pieces of documentation,
in Documentation/DMA-API.txt
void
dma_unmap_sg(struct device *dev, struct scatterlist *sg,
int nhwentries, enum dma_data_direction direction)
Unmap the previously mapped scatter/gather list. All the parameters
must be the same as those and passed in to the scatter/gather mapping
API.
Note: <nents> must be the number you passed in, *not* the number of
physical entries returned.
Note the last paragraph! But in arch/arm/mm/dma-mapping.c;
/**
* dma_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg
* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
* @sg: list of buffers
* @nents: number of buffers to unmap (returned from dma_map_sg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* @dir: DMA transfer direction (same as was passed to dma_map_sg)
*
* Unmap a set of streaming mode DMA translations. Again, CPU access
* rules concerning calls here are the same as for dma_unmap_single().
*/
So the documentation in Documentation/ says one thing, whereas
the ARM implementation documentation says something else.
Which one is it? (Looks like the first one from Documentation/ to me.)
I will happily patch the culprit...
Yours,
Linus Walleij
On Fri, Dec 03, 2010 at 02:40:56PM +0100, Linus Walleij wrote:
> Now we have a contradiction between two pieces of documentation,
> in Documentation/DMA-API.txt
>
>
> void
> dma_unmap_sg(struct device *dev, struct scatterlist *sg,
> int nhwentries, enum dma_data_direction direction)
>
> Unmap the previously mapped scatter/gather list. All the parameters
> must be the same as those and passed in to the scatter/gather mapping
> API.
>
> Note: <nents> must be the number you passed in, *not* the number of
> physical entries returned.
>
>
> Note the last paragraph! But in arch/arm/mm/dma-mapping.c;
>
>
> /**
> * dma_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg
> * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
> * @sg: list of buffers
> * @nents: number of buffers to unmap (returned from dma_map_sg)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> * @dir: DMA transfer direction (same as was passed to dma_map_sg)
> *
> * Unmap a set of streaming mode DMA translations. Again, CPU access
> * rules concerning calls here are the same as for dma_unmap_single().
> */
>
> So the documentation in Documentation/ says one thing, whereas
> the ARM implementation documentation says something else.
>
> Which one is it? (Looks like the first one from Documentation/ to me.)
The only from Documentation/. Luckily though, it doesn't make any
odds to the implementation on ARM as we don't have IOMMUs involved
in the DMA layer where we could coalesce entries.
On Fri, 3 Dec 2010 14:40:56 +0100
Linus Walleij <[email protected]> wrote:
> Now we have a contradiction between two pieces of documentation,
> in Documentation/DMA-API.txt
>
>
> void
> dma_unmap_sg(struct device *dev, struct scatterlist *sg,
> int nhwentries, enum dma_data_direction direction)
>
> Unmap the previously mapped scatter/gather list. All the parameters
> must be the same as those and passed in to the scatter/gather mapping
> API.
>
> Note: <nents> must be the number you passed in, *not* the number of
> physical entries returned.
>
>
> Note the last paragraph! But in arch/arm/mm/dma-mapping.c;
>
>
> /**
> * dma_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg
> * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
> * @sg: list of buffers
> * @nents: number of buffers to unmap (returned from dma_map_sg)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> * @dir: DMA transfer direction (same as was passed to dma_map_sg)
> *
> * Unmap a set of streaming mode DMA translations. Again, CPU access
> * rules concerning calls here are the same as for dma_unmap_single().
> */
>
> So the documentation in Documentation/ says one thing, whereas
> the ARM implementation documentation says something else.
Can you remove DMA-API comments in arch? They simply lead to
confusion.
DMA-API.txt and DMA-API-HOWTO.txt in Documentation should be always
used.