summaryrefslogtreecommitdiffstats
path: root/net/rds/ib.h
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2015-06-16 20:44:07 +0200
committerDavid S. Miller <davem@davemloft.net>2015-06-21 18:32:08 +0200
commitd2a9ec6472650c49ac3f285637b9c04b53f11ae6 (patch)
tree848d2ea1f17d75d20094fca6a9b82bb29548ea5a /net/rds/ib.h
parentpacket: free packet_rollover after synchronize_net (diff)
downloadlinux-d2a9ec6472650c49ac3f285637b9c04b53f11ae6.tar.xz
linux-d2a9ec6472650c49ac3f285637b9c04b53f11ae6.zip
net: rds: use for_each_sg() for scatterlist parsing
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>
Diffstat (limited to 'net/rds/ib.h')
-rw-r--r--net/rds/ib.h22
1 files changed, 14 insertions, 8 deletions
diff --git a/net/rds/ib.h b/net/rds/ib.h
index c36d713229e0..2de28982260c 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -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);
}
}