net: rds: use for_each_sg() for scatterlist parsing
authorFabian Frederick <fabf@skynet.be>
Tue, 16 Jun 2015 18:44:07 +0000 (20:44 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 21 Jun 2015 16:32:08 +0000 (09:32 -0700)
This patch also renames sg to sglist and aligns function parameters.
See Documentation/DMA-API.txt - Part Id for scatterlist details

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rds/ib.h

index c36d713229e0f5c5a1b43fe227a1e04480ba100d..2de28982260c45b1b1bac1e42b0e7ced852e51cc 100644 (file)
@@ -235,28 +235,34 @@ extern struct workqueue_struct *rds_ib_wq;
  * doesn't define it.
  */
 static inline void rds_ib_dma_sync_sg_for_cpu(struct ib_device *dev,
-               struct scatterlist *sg, unsigned int sg_dma_len, int direction)
+                                             struct scatterlist *sglist,
+                                             unsigned int sg_dma_len,
+                                             int direction)
 {
+       struct scatterlist *sg;
        unsigned int i;
 
-       for (i = 0; i < sg_dma_len; ++i) {
+       for_each_sg(sglist, sg, sg_dma_len, i) {
                ib_dma_sync_single_for_cpu(dev,
-                               ib_sg_dma_address(dev, &sg[i]),
-                               ib_sg_dma_len(dev, &sg[i]),
+                               ib_sg_dma_address(dev, sg),
+                               ib_sg_dma_len(dev, sg),
                                direction);
        }
 }
 #define ib_dma_sync_sg_for_cpu rds_ib_dma_sync_sg_for_cpu
 
 static inline void rds_ib_dma_sync_sg_for_device(struct ib_device *dev,
-               struct scatterlist *sg, unsigned int sg_dma_len, int direction)
+                                                struct scatterlist *sglist,
+                                                unsigned int sg_dma_len,
+                                                int direction)
 {
+       struct scatterlist *sg;
        unsigned int i;
 
-       for (i = 0; i < sg_dma_len; ++i) {
+       for_each_sg(sglist, sg, sg_dma_len, i) {
                ib_dma_sync_single_for_device(dev,
-                               ib_sg_dma_address(dev, &sg[i]),
-                               ib_sg_dma_len(dev, &sg[i]),
+                               ib_sg_dma_address(dev, sg),
+                               ib_sg_dma_len(dev, sg),
                                direction);
        }
 }