fix an example of scatterlists handling in DMA-API.txt
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Thu, 18 Sep 2008 16:35:28 +0000 (09:35 -0700)
committerJens Axboe <jens.axboe@oracle.com>
Thu, 9 Oct 2008 06:56:18 +0000 (08:56 +0200)
This example isn't the proper way to handle scatterlists (can't handle
sg chaining).

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Documentation/DMA-API.txt

index d8b63d164e41193927af2c7fb41dcb0893f57878..b8e86460046e7ee3dba003c12de57ae2d6f7fb36 100644 (file)
@@ -337,7 +337,7 @@ With scatterlists, you use the resulting mapping like this:
        int i, count = dma_map_sg(dev, sglist, nents, direction);
        struct scatterlist *sg;
 
-       for (i = 0, sg = sglist; i < count; i++, sg++) {
+       for_each_sg(sglist, sg, count, i) {
                hw_address[i] = sg_dma_address(sg);
                hw_len[i] = sg_dma_len(sg);
        }